mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-03-18 08:56:50 +08:00
fix: 将会话失效处理集中到路由并避免在登录页刷新循环
This commit is contained in:
@@ -32,10 +32,14 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
user.value = result.user || null
|
||||
isAdmin.value = result.is_admin ?? false
|
||||
return result
|
||||
} catch {
|
||||
} catch (e) {
|
||||
isAuthenticated.value = false
|
||||
user.value = null
|
||||
isAdmin.value = false
|
||||
error.value = e instanceof Error ? e.message : 'Not authenticated'
|
||||
if (e instanceof Error) {
|
||||
throw e
|
||||
}
|
||||
throw new Error('Not authenticated')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user