diff --git a/src/models/global.js b/src/models/global.js index 53dcca099d497da95eacdf579811ed6ca1d39e63..ad47737cf8d9f5f4790e854b65d37b1e1208fabb 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 4221ae4d58c4a613663ceb3a012061bae4d947bb..197e3626e45970a1a2796ca11fd91fc513bec01f 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, + }, + }; + }, }, };