chore: change login check api

This commit is contained in:
Joel 2025-10-20 16:27:21 +08:00
parent 7434460b5c
commit d9ef302259
1 changed files with 11 additions and 1 deletions

View File

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