...
|
...
|
@@ -10,12 +10,15 @@ |
|
|
* InitialState
|
|
|
*/
|
|
|
import InitialState from './messageInitialState';
|
|
|
|
|
|
import Immutable, {List, Record} from 'immutable';
|
|
|
|
|
|
|
|
|
const initialState = new InitialState;
|
|
|
const {
|
|
|
MESSAGE_DETAIL,
|
|
|
REQUEST_MSG_LIST,
|
|
|
REQUEST_MSG_LIST_SUCCESS,
|
|
|
REQUEST_MSG_LIST_FAILURE,
|
|
|
} = require('../../constants/actionTypes').default;
|
|
|
/**
|
|
|
* ## guideReducer function
|
...
|
...
|
@@ -29,9 +32,24 @@ export default function messageReducer(state = initialState, action) { |
|
|
case MESSAGE_DETAIL:{
|
|
|
let nextState = state.setIn(['messageDetail', 'title'], action.payload.title)
|
|
|
.setIn(['messageDetail', 'content'], action.payload.content)
|
|
|
.setIn(['messageDetail', 'time'], action.payload.time);
|
|
|
.setIn(['messageDetail', 'time'], action.payload.createTime);
|
|
|
return nextState;
|
|
|
}
|
|
|
case REQUEST_MSG_LIST: {
|
|
|
let nextState = state.set('isFetching', true)
|
|
|
.set('error', null);
|
|
|
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 REQUEST_MSG_LIST_FAILURE: {
|
|
|
return state.set('isFetching', false)
|
|
|
.set('error', action.payload);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
...
|
...
|
|