mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
fix(Setup): fix organization setup.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import { createTableStateReducers } from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
@@ -12,15 +13,21 @@ const initialState = {
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:bills';
|
||||
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('BILLS'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
}
|
||||
});
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
},
|
||||
CONFIG,
|
||||
reducerInstance,
|
||||
);
|
||||
@@ -1,9 +1,10 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import {
|
||||
createTableStateReducers,
|
||||
} from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
@@ -12,17 +13,23 @@ const initialState = {
|
||||
},
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('ESTIMATES'),
|
||||
});
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:estimates';
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('ESTIMATES'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
},
|
||||
});
|
||||
|
||||
export default persistReducer(
|
||||
CONFIG,
|
||||
reducerInstance,
|
||||
);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import {
|
||||
createTableStateReducers,
|
||||
} from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
@@ -12,17 +13,23 @@ const initialState = {
|
||||
},
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('INVOICES'),
|
||||
});
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:invoices';
|
||||
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('INVOICES'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
}
|
||||
});
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
},
|
||||
CONFIG,
|
||||
reducerInstance,
|
||||
);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import {
|
||||
createTableStateReducers,
|
||||
} from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
@@ -13,17 +14,20 @@ const initialState = {
|
||||
},
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('PAYMENT_MADES'),
|
||||
});
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:paymentMades';
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
}
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('PAYMENT_MADES'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
},
|
||||
reducerInstance,
|
||||
);
|
||||
});
|
||||
|
||||
export default persistReducer(CONFIG, reducerInstance);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import {
|
||||
createTableStateReducers,
|
||||
} from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
@@ -12,17 +13,23 @@ const initialState = {
|
||||
},
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('PAYMENT_RECEIVES'),
|
||||
});
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:paymentReceives';
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('PAYMENT_RECEIVES'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
},
|
||||
});
|
||||
|
||||
export default persistReducer(
|
||||
CONFIG,
|
||||
reducerInstance,
|
||||
);
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
import { createReducer} from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import {
|
||||
createTableStateReducers,
|
||||
} from 'store/tableState.reducer';
|
||||
import { createTableStateReducers } from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {},
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('ACCOUNTS'),
|
||||
});
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:accounts';
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
},
|
||||
reducerInstance,
|
||||
);
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('ACCOUNTS'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
}
|
||||
});
|
||||
|
||||
export default persistReducer(CONFIG, reducerInstance);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import purgeStoredState from 'redux-persist/es/purgeStoredState';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import t from 'store/types';
|
||||
|
||||
@@ -14,10 +15,16 @@ const initialState = {
|
||||
};
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:authentication';
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
blacklist: ['errors'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
[t.LOGIN_SUCCESS]: (state, action) => {
|
||||
const { token, user, tenant } = action.payload;
|
||||
|
||||
state.token = token;
|
||||
state.user = user;
|
||||
state.organization = tenant.organization_id;
|
||||
@@ -32,14 +39,14 @@ const reducerInstance = createReducer(initialState, {
|
||||
[t.LOGIN_CLEAR_ERRORS]: (state) => {
|
||||
state.errors = [];
|
||||
},
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
}
|
||||
});
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
blacklist: ['errors'],
|
||||
storage,
|
||||
},
|
||||
CONFIG,
|
||||
reducerInstance,
|
||||
);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import t from 'store/types';
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
|
||||
const initialState = {
|
||||
@@ -20,6 +20,12 @@ const initialState = {
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:dashboard';
|
||||
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['sidebarExpended', 'previousSidebarExpended'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
[t.CHANGE_DASHBOARD_PAGE_TITLE]: (state, action) => {
|
||||
state.pageTitle = action.pageTitle;
|
||||
@@ -115,19 +121,13 @@ const reducerInstance = createReducer(initialState, {
|
||||
const { backLink } = action.payload;
|
||||
state.backLink = backLink;
|
||||
},
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
},
|
||||
});
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: [
|
||||
'sidebarExpended',
|
||||
'previousSidebarExpended',
|
||||
],
|
||||
storage,
|
||||
},
|
||||
reducerInstance,
|
||||
);
|
||||
export default persistReducer(CONFIG, reducerInstance);
|
||||
|
||||
export const getDialogPayload = (state, dialogName) => {
|
||||
return typeof state.dashboard.dialogs[dialogName] !== 'undefined'
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import { createTableStateReducers } from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
@@ -10,17 +11,20 @@ const initialState = {
|
||||
},
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('EXPENSES'),
|
||||
});
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:expenses';
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
},
|
||||
reducerInstance,
|
||||
);
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('EXPENSES'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
}
|
||||
});
|
||||
|
||||
export default persistReducer(CONFIG, reducerInstance);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import { createTableStateReducers } from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
@@ -12,17 +13,20 @@ const initialState = {
|
||||
selectedRows: [],
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('INVENTORY_ADJUSTMENTS'),
|
||||
});
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:inventoryAdjustments';
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('INVENTORY_ADJUSTMENTS'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
},
|
||||
reducerInstance,
|
||||
);
|
||||
});
|
||||
|
||||
export default persistReducer(CONFIG, reducerInstance);
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import {
|
||||
createTableStateReducers,
|
||||
} from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
// Initial state.
|
||||
const initialState = {
|
||||
tableState: {},
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('ITEMS_CATEGORIES'),
|
||||
});
|
||||
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:itemCategories';
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('ITEMS_CATEGORIES'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
},
|
||||
});
|
||||
|
||||
export default persistReducer(
|
||||
CONFIG,
|
||||
reducerInstance,
|
||||
);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import { createTableStateReducers } from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
@@ -12,17 +13,23 @@ const initialState = {
|
||||
selectedRows: [],
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('ITEMS'),
|
||||
});
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:items';
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('ITEMS'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
},
|
||||
});
|
||||
|
||||
export default persistReducer(
|
||||
CONFIG,
|
||||
reducerInstance,
|
||||
);
|
||||
@@ -1,7 +1,8 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import { createTableStateReducers } from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
@@ -10,17 +11,20 @@ const initialState = {
|
||||
},
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('MANUAL_JOURNALS'),
|
||||
});
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:manualJournals';
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('MANUAL_JOURNALS'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
},
|
||||
reducerInstance,
|
||||
);
|
||||
});
|
||||
|
||||
export default persistReducer(CONFIG, reducerInstance);
|
||||
|
||||
@@ -14,7 +14,10 @@ const reducer = createReducer(initialState, {
|
||||
const _dataByOrganizationId = {};
|
||||
|
||||
organizations.forEach((organization) => {
|
||||
_data[organization.id] = organization;
|
||||
_data[organization.id] = {
|
||||
...state.data[organization.id],
|
||||
...organization,
|
||||
};
|
||||
_dataByOrganizationId[organization.organization_id] = organization.id;
|
||||
});
|
||||
state.data = _data;
|
||||
|
||||
@@ -6,16 +6,28 @@ export default (mapState) => {
|
||||
isOrganizationSetupCompleted,
|
||||
isOrganizationInitialized,
|
||||
isOrganizationSeeded,
|
||||
|
||||
isSubscriptionActive
|
||||
} = props;
|
||||
|
||||
const mapped = {
|
||||
const condits = {
|
||||
isCongratsStep: isOrganizationSetupCompleted,
|
||||
isSubscriptionStep: !isSubscriptionActive,
|
||||
isInitializingStep: isSubscriptionActive && !isOrganizationInitialized,
|
||||
isOrganizationStep: isOrganizationInitialized && !isOrganizationSeeded,
|
||||
};
|
||||
|
||||
const scenarios = [
|
||||
{ condition: condits.isCongratsStep, step: 'congrats' },
|
||||
{ condition: condits.isSubscriptionStep, step: 'subscription' },
|
||||
{ condition: condits.isInitializingStep, step: 'initializing' },
|
||||
{ condition: condits.isOrganizationStep, step: 'organization' },
|
||||
];
|
||||
const setupStep = scenarios.find((scenario) => scenario.condition);
|
||||
const mapped = {
|
||||
...condits,
|
||||
setupStepId: setupStep?.step,
|
||||
setupStepIndex: scenarios.indexOf(setupStep) ,
|
||||
};
|
||||
return mapState ? mapState(mapped, state, props) : mapped;
|
||||
};
|
||||
return connect(mapStateToProps);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import {
|
||||
createTableStateReducers,
|
||||
} from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
@@ -11,18 +12,24 @@ const initialState = {
|
||||
pageIndex: 0,
|
||||
},
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('RECEIPTS'),
|
||||
});
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:receipts';
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('RECEIPTS'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
},
|
||||
});
|
||||
|
||||
export default persistReducer(
|
||||
CONFIG,
|
||||
reducerInstance,
|
||||
);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { camelCase } from 'lodash';
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import t from 'store/types';
|
||||
import { optionsArrayToMap } from 'utils';
|
||||
|
||||
const initialState = {
|
||||
data: {
|
||||
organization: {
|
||||
name: 'Bigcapital, Limited Liabilities',
|
||||
name: 'Bigcapital, LLC',
|
||||
},
|
||||
manualJournals: {},
|
||||
bills: {},
|
||||
|
||||
@@ -21,4 +21,5 @@ export const setSubscriptions = (subscriptions) => {
|
||||
subscriptions,
|
||||
},
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
33
client/src/store/vendors/vendors.reducer.js
vendored
33
client/src/store/vendors/vendors.reducer.js
vendored
@@ -1,9 +1,8 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer } from 'redux-persist';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import {
|
||||
createTableStateReducers,
|
||||
} from 'store/tableState.reducer';
|
||||
import { createTableStateReducers } from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
@@ -11,17 +10,21 @@ const initialState = {
|
||||
pageIndex: 0,
|
||||
},
|
||||
};
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('VENDORS'),
|
||||
});
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:vendors';
|
||||
|
||||
export default persistReducer(
|
||||
{
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
},
|
||||
reducerInstance,
|
||||
);
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('VENDORS'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
}
|
||||
});
|
||||
|
||||
export default persistReducer(CONFIG, reducerInstance);
|
||||
|
||||
Reference in New Issue
Block a user