Merge branch 'handle-null-group' into 'develop'
Handle null group in confirmation step See merge request soapbox-pub/soapbox!2472
This commit is contained in:
commit
b0ac174f80
2 changed files with 9 additions and 5 deletions
|
@ -94,7 +94,7 @@ const CreateGroupModal: React.FC<ICreateGroupModal> = ({ onClose }) => {
|
|||
case Steps.TWO:
|
||||
return <DetailsStep params={params} onChange={setParams} />;
|
||||
case Steps.THREE:
|
||||
return <ConfirmationStep group={group!} />;
|
||||
return <ConfirmationStep group={group} />;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import copy from 'soapbox/utils/copy';
|
|||
import type { Group } from 'soapbox/schemas';
|
||||
|
||||
interface IConfirmationStep {
|
||||
group: Group
|
||||
group: Group | null
|
||||
}
|
||||
|
||||
const messages = defineMessages({
|
||||
|
@ -19,20 +19,24 @@ const ConfirmationStep: React.FC<IConfirmationStep> = ({ group }) => {
|
|||
const intl = useIntl();
|
||||
|
||||
const handleCopyLink = () => {
|
||||
copy(`${window.location.origin}/group/${group.slug}`, () => {
|
||||
copy(`${window.location.origin}/group/${group?.slug}`, () => {
|
||||
toast.success(intl.formatMessage(messages.copied));
|
||||
});
|
||||
};
|
||||
|
||||
const handleShare = () => {
|
||||
navigator.share({
|
||||
text: group.display_name,
|
||||
url: group.uri,
|
||||
text: group?.display_name,
|
||||
url: group?.uri,
|
||||
}).catch((e) => {
|
||||
if (e.name !== 'AbortError') console.error(e);
|
||||
});
|
||||
};
|
||||
|
||||
if (!group) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Stack space={9}>
|
||||
<Stack space={3}>
|
||||
|
|
Loading…
Reference in a new issue