Explorar el Código

clear notices count

afc163 hace 8 años
padre
commit
ab20621586
Se han modificado 2 ficheros con 16 adiciones y 0 borrados
  1. 7 0
      src/models/global.js
  2. 9 0
      src/models/user.js

+ 7 - 0
src/models/global.js

@@ -21,6 +21,13 @@ export default {
         payload: data,
         payload: data,
       });
       });
     },
     },
+    *clearNotices(_, { put, select }) {
+      const count = yield select(state => state.global.notices.length);
+      yield put({
+        type: 'user/changeNotifyCount',
+        payload: count,
+      });
+    },
   },
   },
 
 
   reducers: {
   reducers: {

+ 9 - 0
src/models/user.js

@@ -53,5 +53,14 @@ export default {
         currentUser: action.payload,
         currentUser: action.payload,
       };
       };
     },
     },
+    changeNotifyCount(state, action) {
+      return {
+        ...state,
+        currentUser: {
+          ...state.currentUser,
+          notifyCount: action.payload,
+        },
+      };
+    },
   },
   },
 };
 };