Fix logout bug

This commit is contained in:
2023-10-15 12:51:59 +08:00
parent 4e6067788a
commit aa07361813
2 changed files with 7 additions and 6 deletions

View File

@@ -52,10 +52,11 @@ const ToolsFramework: React.FC = () => {
}
const handleLogout = () => {
logout()
void logout().finally(() => {
setTimeout(() => {
window.location.reload()
}, 1500)
})
}
return (

View File

@@ -11,8 +11,8 @@ export const login = async (username: string, password: string) => {
})
}
export const logout = () => {
void request.post('/logout').finally(() => {
export const logout = async () => {
return request.post('/logout').finally(() => {
removeLocalStorage('userInfo')
removeLocalStorage(TOKEN_NAME)
})