Skip to content

Commit 9172f6f

Browse files
committed
fixed addChild and addComponent action creators to return an action
1 parent 52fff1b commit 9172f6f

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"electron": "cross-env NODE_ENV=development electron .",
7272
"build": "cross-env NODE_ENV=production webpack --config webpack.config.production.js",
7373
"build-bin": "electron-builder -mwl",
74-
"test": "cross-env NODE_ENV=test jest",
74+
"test": "cross-env NODE_ENV=test jest --verbose",
7575
"test:clear": "cross-env NODE_ENV=test jest --clearCache",
7676
"linter": "eslint src",
7777
"develop": "concurrently \"npm run dev\" \"npm run electron\""

src/actions/actionCreators.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,15 @@ export const addChild = ({
5252
title: string;
5353
childType: string;
5454
HTMLInfo: object;
55-
}) => (dispatch: (arg: Action) => void) => {
56-
dispatch({ type: ADD_CHILD, payload: { title, childType, HTMLInfo } });
57-
};
58-
59-
export const addComponent = ({ title }: { title: string }) => (
60-
dispatch: (arg: Action) => void
61-
) => {
62-
dispatch({ type: ADD_COMPONENT, payload: { title } });
63-
};
64-
55+
}): {
56+
type: string;
57+
payload: { title: string; childType: string; HTMLInfo: object };
58+
} => ({ type: ADD_CHILD, payload: { title, childType, HTMLInfo } });
59+
60+
export const addComponent = ({ title }: { title: string }) => ({
61+
type: ADD_COMPONENT,
62+
payload: { title }
63+
});
6564
export const addProp = ({ key, type }: { key: string; type: string }) => ({
6665
type: ADD_PROP,
6766
payload: { key, type }
@@ -102,7 +101,6 @@ export const changeFocusChild = ({ childId }: { childId: number }) => (
102101
dispatch({ type: CHANGE_FOCUS_CHILD, payload: { childId } });
103102
};
104103

105-
106104
export const changeFocusComponent = ({ title }: { title: string }) => (
107105
dispatch: (arg: Action) => void
108106
) => {
@@ -168,7 +166,6 @@ export const deleteAllData = () => ({
168166
type: DELETE_ALL_DATA
169167
});
170168

171-
172169
export const deleteComponent = ({
173170
componentId,
174171
stateComponents
@@ -306,7 +303,7 @@ export const toggleEditMode = ({ id }: { id: number }) => (
306303
};
307304

308305
export const toggleNative = () => ({
309-
type: TOGGLE_NATIVE,
306+
type: TOGGLE_NATIVE
310307
});
311308

312309
export const undo = () => ({

0 commit comments

Comments
 (0)