34 lines
837 B
JavaScript
34 lines
837 B
JavaScript
|
export function reducer(state, action) {
|
||
|
switch (action.type) {
|
||
|
case "OnPagerChange": {
|
||
|
return {
|
||
|
...state,
|
||
|
pager: {
|
||
|
...state.pager,
|
||
|
...action.payload
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
case "OnExportRequest": {
|
||
|
return {
|
||
|
...state,
|
||
|
export: action.value
|
||
|
};
|
||
|
}
|
||
|
default: {
|
||
|
return state;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export const dispatchActions = dispatch => ({
|
||
|
onFilterPropertyValueChange: (prop, value) =>
|
||
|
dispatch({ type: "OnFilterPropertyValueChange", payload: { prop, value } }),
|
||
|
|
||
|
onPagerChange: pager =>
|
||
|
dispatch({ type: "OnPagerChange", payload: { ...pager } }),
|
||
|
onSetCachedFilters: cachedFilters =>
|
||
|
dispatch({ type: "OnSetCachedFilters", payload: cachedFilters }),
|
||
|
onExportRequest: value => dispatch({ type: "OnExportRequest", value: value })
|
||
|
});
|