Browse Source

HW корректировка cartReducer done

Vladimir 2 years ago
parent
commit
40963c0ac8
1 changed files with 5 additions and 5 deletions
  1. 5 5
      HW Мой МАГАЗЫН/main.js

+ 5 - 5
HW Мой МАГАЗЫН/main.js

@@ -99,7 +99,7 @@ let jwtDecode = function(token) {
     }
 };
 
-const authReducer = function(state = {}, {type, token}) {
+const authReducer = function(state, {type, token}) {
     let payload;
 
     if (state == undefined) {
@@ -115,12 +115,12 @@ const authReducer = function(state = {}, {type, token}) {
 
         if(payload) {
             localStorage.authToken = token;
+            return {
+                token: token,
+                payload: payload
+            }
         }
 
-        return {
-            token: token,
-            payload: payload
-        }
     };
     if (type == "AUTH_LOGOUT") {
         localStorage.removeItem("authToken");