PromucFlow_constructor/app/client/src/reducers/uiReducers/editorReducer.tsx

34 lines
1.0 KiB
TypeScript
Raw Normal View History

import { createReducer } from "../../utils/AppsmithUtils";
2019-09-26 11:11:28 +00:00
import { getEditorConfigs } from "../../constants/ApiConstants";
2019-10-18 08:16:26 +00:00
import { ReduxActionTypes } from "../../constants/ReduxActionConstants";
import { WidgetProps } from "../../widgets/BaseWidget";
import { ContainerWidgetProps } from "../../widgets/ContainerWidget";
2019-09-27 16:05:33 +00:00
2019-09-26 11:11:28 +00:00
const editorConfigs = getEditorConfigs();
const initialState: EditorReduxState = {
pageWidgetId: "0",
2019-09-26 11:11:28 +00:00
...editorConfigs,
isSaving: false,
};
2019-08-26 12:41:21 +00:00
const editorReducer = createReducer(initialState, {
[ReduxActionTypes.SAVE_PAGE_INIT]: (state: EditorReduxState) => {
return { ...state, isSaving: true };
},
[ReduxActionTypes.SAVE_PAGE_SUCCESS]: (state: EditorReduxState) => {
return { ...state, isSaving: false };
},
});
2019-08-26 12:41:21 +00:00
export interface EditorReduxState {
dsl?: ContainerWidgetProps<WidgetProps>;
pageWidgetId: string;
currentPageId: string;
currentLayoutId: string;
currentPageName: string;
propertyPaneConfigsId: string;
isSaving: boolean;
2019-08-26 12:41:21 +00:00
}
export default editorReducer;