🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!
Fix #225: redirect to login when the JWT expires
Omega (QA)5f6a3dd29ab6
diff --git a/frontend/js/services/apiService.js b/frontend/js/services/apiService.jsindex 8eae066..89d3a68 100644--- a/frontend/js/services/apiService.js+++ b/frontend/js/services/apiService.js@@ -8,6 +8,11 @@ async function baseRequest(path, options = {}) {}const opts = { ...options, headers };const response = await fetch(path, opts);+ if (response.status === 401) {+ // Token expired or invalid (issue #225): drop the cached session and+ // send the user to the login page instead of rendering a stale UI.+ try { await authService.logout(); } catch { /* ignore */ }+ }if (!response.ok) {const data = await safeErrorData(response);let message;