mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-27 05:30:14 +08:00
52 lines
1.0 KiB
JavaScript
52 lines
1.0 KiB
JavaScript
import {
|
|
FETCH_PROJECT_LIST,
|
|
PROJECT_ADD,
|
|
PROJECT_DEL,
|
|
CHANGE_UPDATE_MODAL,
|
|
CHANGE_TABLE_LOADING
|
|
} from '../../constants/action-types';
|
|
|
|
const initialState = {
|
|
isUpdateModalShow: false,
|
|
handleUpdateIndex: -1,
|
|
projectList: [],
|
|
userInfo: {},
|
|
tableLoading: true,
|
|
total: 0,
|
|
currPage: 1
|
|
};
|
|
|
|
export default (state = initialState, action) => {
|
|
switch (action.type) {
|
|
case CHANGE_UPDATE_MODAL: {
|
|
return {
|
|
...state,
|
|
isUpdateModalShow: action.payload.data,
|
|
handleUpdateIndex: action.payload.index
|
|
};
|
|
}
|
|
case CHANGE_TABLE_LOADING: {
|
|
return {
|
|
...state,
|
|
tableLoading: action.payload
|
|
}
|
|
}
|
|
case FETCH_PROJECT_LIST: {
|
|
return {
|
|
...state,
|
|
projectList: action.payload.data.data.list,
|
|
total: action.payload.data.data.total,
|
|
userInfo: action.payload.data.data.userinfo
|
|
};
|
|
}
|
|
case PROJECT_ADD: {
|
|
return state;
|
|
}
|
|
case PROJECT_DEL: {
|
|
return state;
|
|
}
|
|
default:
|
|
return state;
|
|
}
|
|
};
|