From 12da0429b025a2814a765c7b6254f23e00b2be79 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Sun, 12 Jul 2026 09:33:02 -0400 Subject: [PATCH] Preserve destination on session-expiry login; compact the tokens table The 401 interceptor (session expired) redirected to bare /login, losing the page the user was on - the router guard already preserved it but the expiry path bypassed the guard. The interceptor now carries ?redirect= like the guard does, and Login returns there. The API tokens tables overflowed the card: the token column no longer repeats the shopdb_pat_ prefix per row (short prefix shown, full form on hover) - the token itself was already never displayed after creation. Co-Authored-By: Claude Fable 5 --- frontend/src/api/index.js | 9 +++++++-- frontend/src/views/settings/ApiTokensList.vue | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/api/index.js b/frontend/src/api/index.js index 9d1a289..5da01e0 100644 --- a/frontend/src/api/index.js +++ b/frontend/src/api/index.js @@ -28,9 +28,14 @@ api.interceptors.response.use( const hadToken = localStorage.getItem('token') localStorage.removeItem('token') localStorage.removeItem('user') - // Only redirect if user was previously logged in (session expired) + // Only redirect if user was previously logged in (session expired). + // Preserve the destination so login returns the user to this page. if (hadToken) { - window.location.href = '/login' + const here = window.location.pathname + window.location.search + const target = here && here !== '/login' + ? '/login?redirect=' + encodeURIComponent(here) + : '/login' + window.location.href = target } } return Promise.reject(error) diff --git a/frontend/src/views/settings/ApiTokensList.vue b/frontend/src/views/settings/ApiTokensList.vue index 1557794..d545228 100644 --- a/frontend/src/views/settings/ApiTokensList.vue +++ b/frontend/src/views/settings/ApiTokensList.vue @@ -35,7 +35,7 @@ {{ token.name }} - {{ token.displayprefix }}... + {{ token.tokenprefix }}... {{ scopeSummary(token) }} {{ formatDate(token.createddate) }} {{ token.expiresat ? formatDate(token.expiresat) : 'Never' }} @@ -84,7 +84,7 @@ {{ token.username || '-' }} {{ token.name }} - {{ token.displayprefix }}... + {{ token.tokenprefix }}... {{ scopeSummary(token) }} {{ token.expiresat ? formatDate(token.expiresat) : 'Never' }} {{ token.lastusedat ? formatDate(token.lastusedat) : 'Never' }}