diff --git a/src/pages/ToolsFramework.tsx b/src/pages/ToolsFramework.tsx index 20f62a9..c386c86 100644 --- a/src/pages/ToolsFramework.tsx +++ b/src/pages/ToolsFramework.tsx @@ -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 ( diff --git a/src/utils/auth.ts b/src/utils/auth.ts index a923968..aa3fc82 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -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) })