mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-08 01:45:28 +00:00
Refactor invite state handling and add group invite message
This commit is contained in:
@@ -82,7 +82,7 @@ export function EmbedInvite({ code }: Props) {
|
|||||||
const [error, setError] = useState<string | undefined>(undefined);
|
const [error, setError] = useState<string | undefined>(undefined);
|
||||||
const [joinError, setJoinError] = useState<string | undefined>(undefined);
|
const [joinError, setJoinError] = useState<string | undefined>(undefined);
|
||||||
const [invite, setInvite] = useState<
|
const [invite, setInvite] = useState<
|
||||||
(API.InviteResponse & { type: "Server" }) | undefined
|
API.InviteResponse | undefined
|
||||||
>(undefined);
|
>(undefined);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -93,7 +93,7 @@ export function EmbedInvite({ code }: Props) {
|
|||||||
client
|
client
|
||||||
.fetchInvite(code)
|
.fetchInvite(code)
|
||||||
.then((data) =>
|
.then((data) =>
|
||||||
setInvite(data as API.InviteResponse & { type: "Server" }),
|
setInvite(data as API.InviteResponse),
|
||||||
)
|
)
|
||||||
.catch((err) => setError(takeError(err)));
|
.catch((err) => setError(takeError(err)));
|
||||||
}
|
}
|
||||||
@@ -114,6 +114,17 @@ export function EmbedInvite({ code }: Props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (invite.type === "Group") {
|
||||||
|
return (
|
||||||
|
<EmbedInviteBase>
|
||||||
|
<ServerIcon size={55} />
|
||||||
|
<EmbedInviteDetails>
|
||||||
|
<EmbedInviteName>Group Invites are not supported at this time.</EmbedInviteName>
|
||||||
|
</EmbedInviteDetails>
|
||||||
|
</EmbedInviteBase>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<EmbedInviteBase>
|
<EmbedInviteBase>
|
||||||
|
|||||||
Reference in New Issue
Block a user