This commit is contained in:
2026-09-19 22:54:22 +08:00
parent 3054096995
commit ad8e1fd2c2
2 changed files with 9 additions and 25 deletions
+5 -9
View File
@@ -224,15 +224,11 @@ export const useAuthStore = defineStore('admin-auth', () => {
}
async function restoreSession() {
if (isAuthenticated.value) {
if (!refreshToken.value) return true
try {
await refreshSession()
return true
} catch {
return false
}
}
// The constructor has already validated a persisted access token. Reusing
// a still-valid token lets the app mount immediately; refresh only remains
// necessary after the access token has expired and the constructor has
// retained the persisted refresh token for recovery.
if (isAuthenticated.value) return true
if (!refreshToken.value) return false
try {
await refreshSession()