organize exports pt 2.1
This commit is contained in:
parent
9e225d897e
commit
ac63898c4e
@ -16,30 +16,20 @@ import * as supplierAgent from '@/process/supplier-agent';
|
||||
import * as usedPl from '@/process/used-pl';
|
||||
|
||||
export default function useReactions() {
|
||||
useProcess(leadOpportunity.common);
|
||||
useProcess(leadOpportunity.urls);
|
||||
useProcess(loadKP.common);
|
||||
useProcess(calculate.common);
|
||||
useProcess(calculate.validation);
|
||||
useProcess(supplierAgent.common);
|
||||
useProcess(supplierAgent.validation);
|
||||
useProcess(price.common);
|
||||
useProcess(price.computed);
|
||||
useProcess(price.validation);
|
||||
useProcess(fingap.common);
|
||||
useProcess(fingap.validation);
|
||||
useProcess(loadKP.common);
|
||||
useProcess(leasingWithoutKasko.common);
|
||||
useProcess(subsidy.common);
|
||||
useProcess(leasingObject.common);
|
||||
useProcess(leasingObject.validation);
|
||||
useProcess(configurator.filters);
|
||||
useProcess(configurator.values);
|
||||
useProcess(configurator.validation);
|
||||
useProcess(createKP.common);
|
||||
useProcess(bonuses.common);
|
||||
useProcess(bonuses.validation);
|
||||
useProcess(usedPl.common);
|
||||
useProcess(subsidyImportProgram.common);
|
||||
useProcess(payments.common);
|
||||
useProcess(leadOpportunity);
|
||||
useProcess(loadKP);
|
||||
useProcess(calculate);
|
||||
useProcess(supplierAgent);
|
||||
useProcess(price);
|
||||
useProcess(fingap);
|
||||
useProcess(loadKP);
|
||||
useProcess(leasingWithoutKasko);
|
||||
useProcess(subsidy);
|
||||
useProcess(leasingObject);
|
||||
useProcess(configurator);
|
||||
useProcess(createKP);
|
||||
useProcess(bonuses);
|
||||
useProcess(usedPl);
|
||||
useProcess(subsidyImportProgram);
|
||||
useProcess(payments);
|
||||
}
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './action';
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './action';
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -1,18 +1,21 @@
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import type { Process } from '@/process/types';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { trpcPureClient } from '@/trpc/client';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
export function useProcess(reactions: (context: ProcessContext) => void) {
|
||||
export function useProcess({ reactions }: Process) {
|
||||
const store = useStore();
|
||||
const apolloClient = useApolloClient();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
reactions({
|
||||
apolloClient,
|
||||
queryClient,
|
||||
store,
|
||||
trpcClient: trpcPureClient,
|
||||
Object.keys(reactions).forEach((name) => {
|
||||
const injector = reactions[name];
|
||||
injector({
|
||||
apolloClient,
|
||||
queryClient,
|
||||
store,
|
||||
trpcClient: trpcPureClient,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -1 +1 @@
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
export * from './types';
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -1 +1 @@
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -1 +1 @@
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
@ -9,3 +9,7 @@ export type ProcessContext = {
|
||||
store: RootStore;
|
||||
trpcClient: TRPCPureClient;
|
||||
};
|
||||
|
||||
export type Process = {
|
||||
reactions: Record<string, (context: ProcessContext) => void>;
|
||||
};
|
||||
|
||||
@ -1 +1 @@
|
||||
export * from './reactions';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user