Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
added prepare feature to accept two args
  • Loading branch information
PiyushChandra17 committed Jun 17, 2024
commit 45968e3c7a02f8836ab383058035e3d5973819f9
12 changes: 6 additions & 6 deletions client/modules/IDE/reducers/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ const searchSlice = createSlice({
name: 'search',
initialState,
reducers: {
setSearchTerm: (state, action) => {
const { scope, query } = action.payload;
return {
...state,
[`${scope}SearchTerm`]: query
};
setSearchTerm: {
reducer: (state, action) => {
const { scope, query } = action.payload;
state[`${scope}SearchTerm`] = query;
},
prepare: (scope, query) => ({ payload: { scope, query } })
}
}
});
Expand Down
10 changes: 6 additions & 4 deletions client/modules/IDE/reducers/sorting.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ const sortingSlice = createSlice({
state.direction === DIRECTION.ASC ? DIRECTION.DESC : DIRECTION.ASC;
return { ...state, direction };
},
setSorting: (state, action) => {
const { field, direction } = action.payload;
console.log(field);
return { ...state, field, direction };
setSorting: {
reducer: (state, action) => {
const { field, direction } = action.payload;
return { ...state, field, direction };
},
prepare: (field, direction) => ({ payload: { field, direction } })
}
}
});
Expand Down