verdnatura-chat/app/reducers/messages.js

33 lines
587 B
JavaScript
Raw Normal View History

2017-08-17 06:28:41 +00:00
import * as types from '../actions/actionsTypes';
const initialState = {
isFetching: false,
failure: false
};
export default function messages(state = initialState, action) {
switch (action.type) {
case types.MESSAGES.REQUEST:
2017-11-13 12:58:35 +00:00
return {
...state,
2017-08-17 06:28:41 +00:00
isFetching: true
};
case types.MESSAGES.SUCCESS:
2017-11-13 12:58:35 +00:00
return {
...state,
2017-08-17 06:28:41 +00:00
isFetching: false
};
case types.LOGIN.FAILURE:
2017-11-13 12:58:35 +00:00
return {
...state,
2017-08-17 06:28:41 +00:00
isFetching: false,
failure: true,
errorMessage: action.err
};
// case types.LOGOUT:
// return initialState;
default:
return state;
}
}