chore: use new api to check login status (#27143)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Joel 2025-10-20 16:54:31 +08:00 committed by GitHub
parent 9f22b2726b
commit d7d9abb007
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -116,7 +116,19 @@ export const useIsLogin = () => {
queryKey: [NAME_SPACE, 'is-login'],
staleTime: 0,
gcTime: 0,
queryFn: () => get<isLogin>('/login/status'),
queryFn: async (): Promise<isLogin> => {
try {
await get('/account/profile', {
silent: true,
})
}
catch (e: any) {
if(e.status === 401)
return { logged_in: false }
return { logged_in: true }
}
return { logged_in: true }
},
})
}