From ab20621586e3709b6b1086ead79cc2fd0dc0180e Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 19 Oct 2017 19:57:29 +0800 Subject: [PATCH] clear notices count --- src/models/global.js | 7 +++++++ src/models/user.js | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/src/models/global.js b/src/models/global.js index 53dcca09..ad47737c 100644 --- a/src/models/global.js +++ b/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: { diff --git a/src/models/user.js b/src/models/user.js index 4221ae4d..197e3626 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -53,5 +53,14 @@ export default { currentUser: action.payload, }; }, + changeNotifyCount(state, action) { + return { + ...state, + currentUser: { + ...state.currentUser, + notifyCount: action.payload, + }, + }; + }, }, }; -- GitLab