mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
re-structure to monorepo.
This commit is contained in:
29
packages/webapp/src/store/queryReducers.tsx
Normal file
29
packages/webapp/src/store/queryReducers.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
// @ts-nocheck
|
||||
|
||||
|
||||
export const createTableQueryReducers =
|
||||
(resourceName = '', reducer) =>
|
||||
(state, action) => {
|
||||
const RESOURCE_NAME = resourceName.toUpperCase();
|
||||
|
||||
switch (action.type) {
|
||||
case `${RESOURCE_NAME}/TABLE_QUERY_SET`:
|
||||
return {
|
||||
...state,
|
||||
tableQuery: {
|
||||
...state.tableQuery,
|
||||
[state.key]: state.value,
|
||||
}
|
||||
};
|
||||
case `${RESOURCE_NAME}/TABLE_QUERIES_ADD`:
|
||||
return {
|
||||
...state,
|
||||
tableQuery: {
|
||||
...state.tableQuery,
|
||||
...action.payload.query,
|
||||
}
|
||||
};
|
||||
default:
|
||||
return reducer(state, action);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user