Fix logout bug #36

Merged
FatttSnake merged 1 commits from FatttSnake into dev 2023-10-15 12:53:54 +08:00
2 changed files with 7 additions and 6 deletions
Showing only changes of commit aa07361813 - Show all commits

View File

@@ -52,10 +52,11 @@ const ToolsFramework: React.FC = () => {
}
const handleLogout = () => {
logout()
setTimeout(() => {
window.location.reload()
}, 1500)
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)
})