Fix Account Deletion

This commit is contained in:
BloxerHD 2025-11-04 21:42:44 +00:00
commit 33e66635c3
2 changed files with 16 additions and 2 deletions

View file

@ -81,7 +81,21 @@ function hideDeleteWarning() {
}
async function deleteAccount() {
let token = await getToken(username, password);
let token;
let expiryStr = sessionStorage.getItem("authExpires");
if (expiryStr) { // Expiry exists so token should exist
let expiry = new Date(expiryStr);
if (expiry < new Date()) { // Expired token
window.location.href = "/account/login?redirect=/account"
} else if (!token) { // Expiry Saved but No Token (shouldn't be possible but it'll be caught if it happens)
window.location.href = "/account/login?redirect=/account"
} else {
token = sessionStorage.getItem("authToken");
}
} else { // Token Never Saved in Session
window.location.href = "/account/login?redirect=/account"
}
const response = await fetch("https://account.spfn.net/api/v2/users/@me/delete", {
method: "GET",