π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
Fix user logout when refresh not work
Smaug6739b61a82bfc153
diff --git a/frontend/app/stores/_utils.ts b/frontend/app/stores/_utils.tsindex f881813a..163e9394 100644--- a/frontend/app/stores/_utils.ts+++ b/frontend/app/stores/_utils.ts@@ -29,10 +29,15 @@ async function refreshAccessToken(): Promise<void> {if (!refreshPromise) {refreshPromise = (async () => {console.log('[AUTH] Refreshing access token...');- const res = await customFetch('auth/refresh', 'POST', {});- const data = await res.json();+ try {+ const res = await customFetch('auth/refresh', 'POST', {});+ console.log(res);+ const data = await res.json();++ if (!res.ok || data.status !== 'success') throw new Error('Refresh token invalid');- if (!res.ok || data.status !== 'success') {+ console.log('[AUTH] Access token refreshed.');+ } catch {console.warn('[AUTH] Refresh failed, logging out.');useUserStore().post_logout();@@ -41,8 +46,6 @@ async function refreshAccessToken(): Promise<void> {window.location.replace('/login');throw new Error('Refresh token invalid');}-- console.log('[AUTH] Access token refreshed.');})();// reset the promise when done