afc163 8 лет назад
Родитель
Сommit
ab20621586
2 измененных файлов с 16 добавлено и 0 удалено
  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,
       });
     },
+    *clearNotices(_, { put, select }) {
+      const count = yield select(state => state.global.notices.length);
+      yield put({
+        type: 'user/changeNotifyCount',
+        payload: count,
+      });
+    },
   },
 
   reducers: {

+ 9 - 0
src/models/user.js

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