Skip to content

Commit 45968e3

Browse files
added prepare feature to accept two args
1 parent 680c242 commit 45968e3

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

client/modules/IDE/reducers/search.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ const searchSlice = createSlice({
99
name: 'search',
1010
initialState,
1111
reducers: {
12-
setSearchTerm: (state, action) => {
13-
const { scope, query } = action.payload;
14-
return {
15-
...state,
16-
[`${scope}SearchTerm`]: query
17-
};
12+
setSearchTerm: {
13+
reducer: (state, action) => {
14+
const { scope, query } = action.payload;
15+
state[`${scope}SearchTerm`] = query;
16+
},
17+
prepare: (scope, query) => ({ payload: { scope, query } })
1818
}
1919
}
2020
});

client/modules/IDE/reducers/sorting.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ const sortingSlice = createSlice({
2020
state.direction === DIRECTION.ASC ? DIRECTION.DESC : DIRECTION.ASC;
2121
return { ...state, direction };
2222
},
23-
setSorting: (state, action) => {
24-
const { field, direction } = action.payload;
25-
console.log(field);
26-
return { ...state, field, direction };
23+
setSorting: {
24+
reducer: (state, action) => {
25+
const { field, direction } = action.payload;
26+
return { ...state, field, direction };
27+
},
28+
prepare: (field, direction) => ({ payload: { field, direction } })
2729
}
2830
}
2931
});

0 commit comments

Comments
 (0)