mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
wip
This commit is contained in:
@@ -15,4 +15,17 @@ export const resetCustomersTableState = () => {
|
||||
return {
|
||||
type: t.CUSTOMERS_TABLE_STATE_RESET,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export const setCustomersSelectedRows = (selectedRows) => {
|
||||
return {
|
||||
type: 'CUSTOMERS/SET_SELECTED_ROWS',
|
||||
payload: selectedRows,
|
||||
};
|
||||
};
|
||||
|
||||
export const resetCustomersSelectedRows = () => {
|
||||
return {
|
||||
type: 'CUSTOMERS/RESET_SELECTED_ROWS',
|
||||
};
|
||||
};
|
||||
@@ -3,6 +3,7 @@ import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import { createTableStateReducers } from '@/store/tableState.reducer';
|
||||
import t from '@/store/types';
|
||||
|
||||
// Default table query state.
|
||||
export const defaultTableQueryState = {
|
||||
@@ -16,10 +17,21 @@ export const defaultTableQueryState = {
|
||||
// initial data.
|
||||
const initialState = {
|
||||
tableState: defaultTableQueryState,
|
||||
selectedRows: [],
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('CUSTOMERS', defaultTableQueryState),
|
||||
|
||||
['CUSTOMERS/SET_SELECTED_ROWS']: (state, action) => {
|
||||
state.selectedRows = action.payload;
|
||||
},
|
||||
|
||||
['CUSTOMERS/RESET_SELECTED_ROWS']: (state) => {
|
||||
state.selectedRows = [];
|
||||
},
|
||||
|
||||
[t.RESET]: () => initialState,
|
||||
});
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:estimates';
|
||||
|
||||
@@ -12,4 +12,17 @@ export const resetVendorsTableState = () => {
|
||||
return {
|
||||
type: t.VENDORS_TABLE_STATE_RESET,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const setVendorsSelectedRows = (selectedRows) => {
|
||||
return {
|
||||
type: 'VENDORS/SET_SELECTED_ROWS',
|
||||
payload: selectedRows,
|
||||
};
|
||||
};
|
||||
|
||||
export const resetVendorsSelectedRows = () => {
|
||||
return {
|
||||
type: 'VENDORS/RESET_SELECTED_ROWS',
|
||||
};
|
||||
};
|
||||
@@ -15,6 +15,7 @@ export const defaultTableQueryState = {
|
||||
|
||||
const initialState = {
|
||||
tableState: defaultTableQueryState,
|
||||
selectedRows: [],
|
||||
};
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:vendors';
|
||||
@@ -28,8 +29,17 @@ const CONFIG = {
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('VENDORS', defaultTableQueryState),
|
||||
|
||||
['VENDORS/SET_SELECTED_ROWS']: (state, action) => {
|
||||
state.selectedRows = action.payload;
|
||||
},
|
||||
|
||||
['VENDORS/RESET_SELECTED_ROWS']: (state) => {
|
||||
state.selectedRows = [];
|
||||
},
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
return initialState;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user