diff --git a/client/src/actions/user.ts b/client/src/actions/user.ts index e14ea4c046013922a5e573998170b8bc46c0bcdc..371dcaeb6b9426c4235e9fc837257f5bbc6625f9 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,