kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Handle null group in confirmation step
rodzic
e5cf1dfa85
commit
6cda34fb69
|
@ -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}>
|
||||
|
|
Ładowanie…
Reference in New Issue