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

View File

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

View File

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