If guild already exists, show edit page

This commit is contained in:
Alec LaLonde
2021-09-10 10:54:55 -06:00
committed by Alec LaLonde
parent c7f913dc0c
commit c489ac9924
3 changed files with 3 additions and 16 deletions

View File

@@ -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,

View File

@@ -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
}
}

View File

@@ -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) {