22 lines
610 B
TypeScript
22 lines
610 B
TypeScript
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 }: Process) {
|
|
const store = useStore();
|
|
const apolloClient = useApolloClient();
|
|
const queryClient = useQueryClient();
|
|
|
|
Object.keys(reactions).forEach((name) => {
|
|
const injector = reactions[name];
|
|
injector({
|
|
apolloClient,
|
|
queryClient,
|
|
store,
|
|
trpcClient: trpcPureClient,
|
|
});
|
|
});
|
|
}
|