diff --git a/js/accounts.js b/js/accounts.js index 79a7241..96bdced 100644 --- a/js/accounts.js +++ b/js/accounts.js @@ -85,13 +85,13 @@ async function deleteAccount() { let expiryStr = sessionStorage.getItem("authExpires"); if (expiryStr) { // Expiry exists so token should exist + token = sessionStorage.getItem("authToken"); + 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"