From db53f1403829c815bfe04c22603620a93bfbcda8 Mon Sep 17 00:00:00 2001
From: Emil <Emil>
Date: Tue, 20 Apr 2021 13:53:48 +0200
Subject: [PATCH] fix: logout api error

---
 client/src/actions/user.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/client/src/actions/user.ts b/client/src/actions/user.ts
index e14ea4c0..371dcaeb 100644
--- a/client/src/actions/user.ts
+++ b/client/src/actions/user.ts
@@ -41,8 +41,8 @@ export const getUserData = () => async (dispatch: AppDispatch) => {
 }
 
 export const logoutUser = () => async (dispatch: AppDispatch) => {
+  localStorage.removeItem('token')
   await axios.post('/auth/logout').then(() => {
-    localStorage.removeItem('token')
     delete axios.defaults.headers.common['Authorization']
     dispatch({
       type: Types.SET_UNAUTHENTICATED,
-- 
GitLab