mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
Error handling on donator check page
This commit is contained in:
parent
4cafc41b88
commit
210118bf4d
2 changed files with 10 additions and 1 deletions
|
|
@ -73,5 +73,7 @@
|
|||
"alreadyDonator": "You are already a donator!",
|
||||
"discordNeeded": "You need to link your Discord account to access this page",
|
||||
"discordRoleNeeded": "You need the Donator Discord role to access this page",
|
||||
"addedDonator": "Added donator benefits to your account!"
|
||||
"addedDonator": "Added donator benefits to your account!",
|
||||
"errorDonatorCheck": "Something went wrong when checking your Discord donator status. Please try again later.",
|
||||
"discordRateLimit": "{message} Retry after {retry_after} seconds."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,13 @@ async function getMessage() {
|
|||
}
|
||||
})
|
||||
|
||||
if (memberInfoRes.status == 429) {
|
||||
const { message, retry_after }: { message: string; retry_after: number } = await memberInfoRes.json()
|
||||
return m.discordRateLimit({ message, retry_after })
|
||||
} else if (memberInfoRes.status != 200) {
|
||||
return m.errorDonatorCheck
|
||||
}
|
||||
|
||||
const memberInfo: { roles: string[] } = await memberInfoRes.json()
|
||||
const isDiscordDonator = memberInfo.roles.includes(DISCORD_DONATOR_ID)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue