优化
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user