added psa request failed notification (#3155)

* added psa request failed notification

* fixed prettier issues
This commit is contained in:
smunky 2022-06-20 09:19:08 +10:00 committed by GitHub
parent 709d141aa6
commit bc58cbf613
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,7 +19,15 @@ function setMemory(id: string): void {
async function getLatest(): Promise<MonkeyTypes.PSA[]> {
const response = await Ape.psas.get();
if (response.message === "Server is down for maintenance") {
if (response.status === 500) {
Notifications.addBanner(
"PSA request failed. If this issue persists the server might be experiencing unexpected down time. <a target= '_blank' href='https://monkeytype.instatus.com/'>Check the status page</a> or <a target= '_blank' href='https://twitter.com/monkeytypegame'>Twitter</a> for more information.",
-1,
"exclamation-triangle",
true
);
return [];
} else if (response.status === 503) {
Notifications.addBanner(
"Server is currently under maintenance. <a target= '_blank' href='https://monkeytype.instatus.com/'>Check the status page</a> for more info.",
-1,