client/src/reducers/authReducer.js
changeset 52 96f8a4a59bd9
parent 47 64428c7ebc19
child 53 d8588379529e
--- a/client/src/reducers/authReducer.js	Mon Jun 19 15:05:36 2017 +0200
+++ b/client/src/reducers/authReducer.js	Mon Jun 19 15:36:52 2017 +0200
@@ -9,6 +9,9 @@
 
 export const currentUser = (state = null, action) => {
   switch (action.type) {
+    case types.AUTH_LOGOUT:
+      localStorage.removeItem('currentUser');
+      return null;
     case types.AUTH_LOGIN_SUCCESS:
       return action.user;
     default:
@@ -18,6 +21,9 @@
 
 export const token = (state = null, action) => {
   switch (action.type) {
+    case types.AUTH_LOGOUT:
+      localStorage.removeItem('token');
+      return null;
     case types.AUTH_STORE_TOKEN:
       return action.token;
     default: