wilitp 4 rokov pred
rodič
commit
b215a09310
1 zmenil súbory, kde vykonal 7 pridanie a 1 odobranie
  1. 7 1
      app/src/context/auth/actions.ts

+ 7 - 1
app/src/context/auth/actions.ts

@@ -59,6 +59,12 @@ export const failureDismiss = (): Action => ({
 });
 
 // Accion: logout
-export const logout = (): Action => ({
+export const logoutSync = (): Action => ({
   type: "LOGOUT",
 });
+
+export const logout = () => async (dispatch: Dispatch<Action>) => {
+  localStorage.removeItem(keys.userToken);
+
+  dispatch(logoutSync());
+};