🐛 保留已验证的后台会话
This commit is contained in:
1 parent
2bf610ac22
commit
bb8b1449e1
1 file changed
+6
-1
@@ -9,8 +9,13 @@ export function useAdminSession() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await AuthService.verifyToken()
|
const response = await AuthService.verifyToken()
|
||||||
if (response.code === 200 && response.detail?.token) {
|
// 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)
|
adminStore.login(response.detail)
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in new issue
Block a user