yapi/client/reducer/group/group.js
2017-07-11 16:35:48 +08:00

36 lines
674 B
JavaScript

import {
FETCH_GROUP_LIST,
FETCH_CURR_GROUP
} from '../../constants/action-types';
const initialState = {
groupList: ['Hotel', 'Vacation', 'Flight', 'Pay'],
currGroup: 'MFE'
};
export default (state = initialState, action) => {
switch (action.type) {
case FETCH_GROUP_LIST: {
if (action.payload.res) {
return {
...state,
groupList: action.payload.data,
};
}
return state;
}
case FETCH_CURR_GROUP: {
if (action.payload.res) {
return {
...state,
currGroup: action.payload.data,
};
}
return state;
}
default:
return state;
}
};