diff --git a/frontend/src/ts/elements/psa.ts b/frontend/src/ts/elements/psa.ts index 2904b3cf5..05f527e6b 100644 --- a/frontend/src/ts/elements/psa.ts +++ b/frontend/src/ts/elements/psa.ts @@ -17,7 +17,7 @@ function setMemory(id: string): void { window.localStorage.setItem("confirmedPSAs", JSON.stringify(list)); } -async function getLatest(): Promise { +async function getLatest(): Promise { const response = await Ape.psas.get(); if (response.status === 500) { if (window.location.hostname === "localhost") { @@ -38,7 +38,7 @@ async function getLatest(): Promise { ); } - return []; + return null; } else if (response.status === 503) { Notifications.addBanner( "Server is currently under maintenance. Check the status page for more info.", @@ -48,14 +48,17 @@ async function getLatest(): Promise { undefined, true ); - return []; + return null; + } else if (response.status !== 200) { + return null; } return response.data as MonkeyTypes.PSA[]; } export async function show(): Promise { const latest = await getLatest(); - if (latest == null || latest.length == 0) { + if (latest === null) return; + if (latest.length == 0) { clearMemory(); return; }