mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-27 05:30:14 +08:00
36 lines
674 B
JavaScript
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;
|
|
}
|
|
};
|