🐛 保留已验证的后台会话
This commit is contained in:
1 parent
2bf610ac22
commit
bb8b1449e1
1 file changed
+7
-2
@@ -9,8 +9,13 @@ export function useAdminSession() {
|
||||
|
||||
try {
|
||||
const response = await AuthService.verifyToken()
|
||||
if (response.code === 200 && response.detail?.token) {
|
||||
adminStore.login(response.detail)
|
||||
// The current stored bearer token is what was just verified by the server.
|
||||
// Do not redirect a valid session merely because an adapter omits a token
|
||||
// field in the verification payload; only replace it when one is supplied.
|
||||
if (response.code === 200) {
|
||||
if (response.detail?.token) {
|
||||
adminStore.login(response.detail)
|
||||
}
|
||||
return true
|
||||
}
|
||||
} catch {
|
||||
|
||||
Reference in new issue
Block a user