feat(auth): remove all old localstorage if no session

This commit is contained in:
2025-03-17 16:16:06 -05:00
parent e258aaead9
commit 8fb06c71d3
4 changed files with 44 additions and 16 deletions

1
.gitignore vendored
View File

@@ -8,6 +8,7 @@ builds
nssm.exe nssm.exe
backend-0.1.2-217.zip backend-0.1.2-217.zip
backend-0.1.2-218.zip backend-0.1.2-218.zip
backend-0.1.2.zip
postgresql-17.2-3-windows-x64.exe postgresql-17.2-3-windows-x64.exe

View File

@@ -17,6 +17,16 @@ const fetchSession = async () => {
}); });
// console.log(res); // console.log(res);
if (!res.ok) { if (!res.ok) {
localStorage.removeItem("auth_token");
// remove these for a while if no session just until fully to 2.0 and clearly no one has ran lstv1 in a long time
localStorage.removeItem("ally-supports-cache");
localStorage.removeItem("auth-storage");
localStorage.removeItem("nextauth.message");
localStorage.removeItem("prod");
localStorage.removeItem("cards");
localStorage.removeItem("rememberMe");
localStorage.removeItem("username");
throw new Error("Session not found"); throw new Error("Session not found");
} }

46
package-lock.json generated
View File

@@ -23,11 +23,11 @@
"drizzle-kit": "^0.30.4", "drizzle-kit": "^0.30.4",
"drizzle-orm": "^0.39.3", "drizzle-orm": "^0.39.3",
"drizzle-zod": "^0.7.0", "drizzle-zod": "^0.7.0",
"fast-xml-parser": "^5.0.9",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"mssql": "^11.0.1", "mssql": "^11.0.1",
"nodemailer": "^6.10.0", "nodemailer": "^6.10.0",
"nodemailer-express-handlebars": "^7.0.0", "nodemailer-express-handlebars": "^7.0.0",
"npm-check-updates": "^17.1.15",
"pg": "^8.13.3", "pg": "^8.13.3",
"pino": "^9.6.0", "pino": "^9.6.0",
"pino-abstract-transport": "^2.0.0", "pino-abstract-transport": "^2.0.0",
@@ -5360,6 +5360,24 @@
], ],
"license": "BSD-3-Clause" "license": "BSD-3-Clause"
}, },
"node_modules/fast-xml-parser": {
"version": "5.0.9",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.0.9.tgz",
"integrity": "sha512-2mBwCiuW3ycKQQ6SOesSB8WeF+fIGb6I/GG5vU5/XEptwFFhp9PE8b9O7fbs2dpq9fXn4ULR3UsfydNUCntf5A==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/NaturalIntelligence"
}
],
"license": "MIT",
"dependencies": {
"strnum": "^2.0.5"
},
"bin": {
"fxparser": "src/cli/cli.js"
}
},
"node_modules/fdir": { "node_modules/fdir": {
"version": "6.4.3", "version": "6.4.3",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz",
@@ -8784,20 +8802,6 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/npm-check-updates": {
"version": "17.1.15",
"resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-17.1.15.tgz",
"integrity": "sha512-miATvKu5rjec/1wxc5TGDjpsucgtCHwRVZorZpDkS6NzdWXfnUWlN4abZddWb7XSijAuBNzzYglIdTm9SbgMVg==",
"license": "Apache-2.0",
"bin": {
"ncu": "build/cli.js",
"npm-check-updates": "build/cli.js"
},
"engines": {
"node": "^18.18.0 || >=20.0.0",
"npm": ">=8.12.1"
}
},
"node_modules/npm-run-path": { "node_modules/npm-run-path": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
@@ -10645,6 +10649,18 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/strnum": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.0.5.tgz",
"integrity": "sha512-YAT3K/sgpCUxhxNMrrdhtod3jckkpYwH6JAuwmUdXZsmzH1wUyzTMrrK2wYCEEqlKwrWDd35NeuUkbBy/1iK+Q==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/NaturalIntelligence"
}
],
"license": "MIT"
},
"node_modules/style-mod": { "node_modules/style-mod": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.2.tgz", "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.2.tgz",

View File

@@ -40,6 +40,7 @@
"drizzle-kit": "^0.30.4", "drizzle-kit": "^0.30.4",
"drizzle-orm": "^0.39.3", "drizzle-orm": "^0.39.3",
"drizzle-zod": "^0.7.0", "drizzle-zod": "^0.7.0",
"fast-xml-parser": "^5.0.9",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"mssql": "^11.0.1", "mssql": "^11.0.1",
"nodemailer": "^6.10.0", "nodemailer": "^6.10.0",
@@ -75,4 +76,4 @@
"build": 26, "build": 26,
"oldBuild": "backend-0.1.2.zip" "oldBuild": "backend-0.1.2.zip"
} }
} }