mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
fix: autofill the quick created customer/vendor
This commit is contained in:
@@ -125,3 +125,23 @@ export function closeSidebarSubmenu() {
|
||||
type: t.SIDEBAR_SUBMENU_CLOSE,
|
||||
};
|
||||
}
|
||||
|
||||
export function addAutofill(autofillRef: number, payload: any) {
|
||||
return {
|
||||
type: t.ADD_AUTOFILL_REF,
|
||||
payload: { ref: autofillRef, payload }
|
||||
}
|
||||
}
|
||||
|
||||
export function removeAutofill(autofillRef: number) {
|
||||
return {
|
||||
type: t.REMOVE_AUTOFILL_REF,
|
||||
payload: { ref: autofillRef}
|
||||
}
|
||||
}
|
||||
|
||||
export function resetAutofill() {
|
||||
return {
|
||||
type: t.RESET_AUTOFILL_REF,
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
// @ts-nocheck
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { isUndefined, isNumber } from 'lodash';
|
||||
import { isUndefined, isNumber, omit } from 'lodash';
|
||||
import t from '@/store/types';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
|
||||
|
||||
const initialState = {
|
||||
pageTitle: '',
|
||||
pageSubtitle: '',
|
||||
@@ -23,6 +22,7 @@ const initialState = {
|
||||
appIntlIsLoading: true,
|
||||
sidebarSubmenu: { isOpen: false, submenuId: null },
|
||||
features: {},
|
||||
autofill: {},
|
||||
};
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:dashboard';
|
||||
@@ -143,6 +143,18 @@ const reducerInstance = createReducer(initialState, {
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
},
|
||||
|
||||
[t.ADD_AUTOFILL_REF]: (state, action) => {
|
||||
state.autofill[action.payload.ref] = action.payload.payload || null;
|
||||
},
|
||||
|
||||
[t.REMOVE_AUTOFILL_REF]: (state, action) => {
|
||||
state.autofill = omit(state.autofill, [action.payload.ref]);
|
||||
},
|
||||
|
||||
[t.RESET_AUTOFILL_REF]: (state, action) => {
|
||||
state.autofill = {};
|
||||
},
|
||||
});
|
||||
|
||||
export default persistReducer(CONFIG, reducerInstance);
|
||||
|
||||
@@ -21,4 +21,7 @@ export default {
|
||||
SPLASH_START_LOADING: 'SPLASH_START_LOADING',
|
||||
SPLASH_STOP_LOADING: 'SPLASH_STOP_LOADING',
|
||||
SET_FEATURE_DASHBOARD_META: 'SET_FEATURE_DASHBOARD_META',
|
||||
ADD_AUTOFILL_REF: 'ADD_AUTOFILL_REF',
|
||||
REMOVE_AUTOFILL_REF: 'REMOVE_AUTOFILL_REF',
|
||||
RESET_AUTOFILL_REF: 'RESET_AUTOFILL_REF'
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user