...
|
...
|
@@ -37,47 +37,47 @@ export default function messageReducer(state = initialState, action) { |
|
|
if (!(state instanceof InitialState)) return initialState.merge(state);
|
|
|
|
|
|
switch (action.type) {
|
|
|
case MESSAGE_DETAIL:{
|
|
|
// let nextState = state.setIn(['messageDetail', 'title'], action.payload.title)
|
|
|
// .setIn(['messageDetail', 'content'], action.payload.content)
|
|
|
// .setIn(['messageDetail', 'time'], action.payload.createTime)
|
|
|
// .setIn(['messageDetail', 'id'], action.payload.id)
|
|
|
// .setIn(['messageDetail', 'isRead'], action.payload.isRead)
|
|
|
// .setIn();
|
|
|
case MESSAGE_DETAIL: {
|
|
|
let nextState = state.set('messageDetail', action.payload);
|
|
|
return nextState;
|
|
|
}
|
|
|
case REQUEST_MSG_NUM:
|
|
|
case BATCH_SET_MSG_IS_READ:
|
|
|
case REQUEST_MSG_LIST:
|
|
|
{
|
|
|
|
|
|
case REQUEST_MSG_LIST: {
|
|
|
let nextState = state.set('isFetching', true)
|
|
|
.set('error', null);
|
|
|
return nextState;
|
|
|
}
|
|
|
case REQUEST_MSG_NUM_SUCCESS: {
|
|
|
let nextState = state.set('isFetching', false)
|
|
|
.set('error', null)
|
|
|
.set('unreadNum', action.payload);
|
|
|
return nextState;
|
|
|
}
|
|
|
|
|
|
case REQUEST_MSG_LIST_SUCCESS: {
|
|
|
let nextState = state.set('isFetching', false)
|
|
|
.set('error', null)
|
|
|
.set('messageList', Immutable.fromJS(action.payload.list));
|
|
|
return nextState;
|
|
|
}
|
|
|
case BATCH_SET_MSG_IS_READ_SUCCESS: {
|
|
|
|
|
|
case REQUEST_MSG_LIST_FAILURE: {
|
|
|
return state.set('isFetching', false)
|
|
|
.set('error', null);
|
|
|
.set('error', action.payload);
|
|
|
}
|
|
|
|
|
|
case REQUEST_MSG_NUM_SUCCESS: {
|
|
|
let nextState = state.set('unreadNum', action.payload);
|
|
|
return nextState;
|
|
|
}
|
|
|
|
|
|
case BATCH_SET_MSG_IS_READ_SUCCESS: {
|
|
|
// console.log(state);
|
|
|
let nextState = state.setIn(['messageList', state.messageDetail, 'isRead'], true);
|
|
|
// console.log(nextState);
|
|
|
return nextState;
|
|
|
}
|
|
|
|
|
|
case REQUEST_MSG_NUM:
|
|
|
case REQUEST_MSG_NUM_FAILURE:
|
|
|
case BATCH_SET_MSG_IS_READ:
|
|
|
case BATCH_SET_MSG_IS_READ_FAILURE:
|
|
|
case REQUEST_MSG_LIST_FAILURE:
|
|
|
{
|
|
|
return state.set('isFetching', false)
|
|
|
.set('error', action.payload);
|
|
|
}
|
|
|
return state;
|
|
|
|
|
|
case SWITCH_BRAND:
|
|
|
case LOGOUT:
|
|
|
return initialState;
|
...
|
...
|
|