123456789101112131415161718192021222324252627 |
- import * as mainActions from './main';
- import * as pdfActions from './pdf';
- import * as types from '../constants/actionTypes';
- const createReducer = (handlers: {[key: string]: any}) => (
- state: Record<string, any>,
- action: { type: string },
- ): any => {
- if (!Object.prototype.hasOwnProperty.call(handlers, action.type)) {
- return state;
- }
- return handlers[action.type](state, action);
- };
- export default createReducer({
- [types.SWITCH_NAVBAR]: mainActions.setNavbarState,
- [types.SWITCH_SIDEBAR]: mainActions.setSidebarState,
- [types.SET_CURRENT_PAGE]: pdfActions.setCurrentPage,
- [types.SET_TOTAL_PAGE]: pdfActions.setTotalPage,
- [types.SET_PDF]: pdfActions.setPdf,
- [types.SET_PROGRESS]: pdfActions.setProgress,
- [types.SET_VIEWPORT]: pdfActions.setViewport,
- [types.CHANGE_SCALE]: pdfActions.changeScale,
- [types.CHANGE_ROTATE]: pdfActions.changeRotate,
- });
|