mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-04-24 03:00:09 -04:00
If guild already exists, show edit page
This commit is contained in:
committed by
Alec LaLonde
parent
c7f913dc0c
commit
c489ac9924
@@ -54,7 +54,6 @@ export const handleOAuthCallback = async (
|
||||
const getGuildResponse = await client.GetGuild({
|
||||
id: existingGuild.guild_id,
|
||||
});
|
||||
|
||||
const successResponse: DiscordGuildAuthResponse = {
|
||||
success: true,
|
||||
guildname: getGuildResponse.guild[0].guildname,
|
||||
|
||||
@@ -93,16 +93,8 @@ export const GuildFragment = gql`
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
||||
gql`
|
||||
query GetGuild($guildname: String, $id: uuid, $discordId: String) {
|
||||
guild(
|
||||
where: {
|
||||
_or: [
|
||||
{ id: { _eq: $id } }
|
||||
{ guildname: { _eq: $guildname } }
|
||||
{ discord_id: { _eq: $discordId } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
query GetGuild($id: uuid!) {
|
||||
guild(where: { id: { _eq: $id } }) {
|
||||
...GuildFragment
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,7 @@ const GuildSetupAuthCallback: React.FC = () => {
|
||||
} else if (response?.guildname != null) {
|
||||
// clean up guid
|
||||
remove(discordAuthStateGuidKey);
|
||||
if (response?.exists === true) {
|
||||
router.push(`/guild/${response?.guildname}`);
|
||||
} else {
|
||||
router.push(`/join/guild/${response?.guildname}`);
|
||||
}
|
||||
router.push(`/join/guild/${response?.guildname}`);
|
||||
}
|
||||
};
|
||||
if (!fetching && code) {
|
||||
|
||||
Reference in New Issue
Block a user