I am using react node js with SQL. When I logout from reactJS I am removing the token while logging out. But still when i login within different credentials it takes me to dashboard with old user data and when I refresh page i get the data with new currently logged in user.
What could be it The code part is pretty much correct I guess because it shows perfect data after page refresh.
my logout action
export const logoutAction = () => {
return dispatch => {
localStorage.removeItem('tkn')
dispatch({ type: LOGOUT, payload: "" })
}
}
logout reducer
case LOGOUT:
return {
...state,
token: action.payload,
isAuth: false,
}
Triggered action from the navbar
const logout = () => {
props.logoutUser()
handleDrawerClose()
}