mirror of
https://github.com/langgenius/dify.git
synced 2025-12-13 11:21:26 +00:00
chore: use new api to check login status (#27143)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
9f22b2726b
commit
d7d9abb007
@ -116,7 +116,19 @@ export const useIsLogin = () => {
|
|||||||
queryKey: [NAME_SPACE, 'is-login'],
|
queryKey: [NAME_SPACE, 'is-login'],
|
||||||
staleTime: 0,
|
staleTime: 0,
|
||||||
gcTime: 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 }
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user