process/init: move inject-reactions from page
This commit is contained in:
parent
ea3f4bb52e
commit
183d7f71cb
@ -4,11 +4,8 @@ import initializeApollo from 'apollo/client';
|
||||
import * as Calculation from 'Components/Calculation';
|
||||
import Output from 'Components/Output';
|
||||
import Head from 'next/head';
|
||||
import * as agentsReactions from 'process/agents/reactions';
|
||||
import * as calculateReactions from 'process/calculate/reactions';
|
||||
import getData, { getOwnerData } from 'process/init';
|
||||
import * as leadOpportunityReactions from 'process/lead-opportunity/reactions';
|
||||
import paymentsReactions from 'process/payments/reactions';
|
||||
import getData, { getOwnerData } from 'process/init/get-data';
|
||||
import injectDefaultReactions from 'process/init/inject-reactions/default';
|
||||
import { useEffect } from 'react';
|
||||
import { fetchUser } from 'services/user';
|
||||
import { useStore } from 'stores/hooks';
|
||||
@ -40,22 +37,13 @@ const Grid = styled(Box)`
|
||||
}
|
||||
`;
|
||||
|
||||
function injectReactions(store, apolloClient) {
|
||||
leadOpportunityReactions.common(store, apolloClient);
|
||||
leadOpportunityReactions.urls(store, apolloClient);
|
||||
paymentsReactions(store, apolloClient);
|
||||
calculateReactions.validation(store, apolloClient);
|
||||
agentsReactions.common(store, apolloClient);
|
||||
}
|
||||
|
||||
function Home() {
|
||||
const store = useStore();
|
||||
const apolloClient = useApolloClient();
|
||||
|
||||
useEffect(() => {
|
||||
getData(apolloClient, store);
|
||||
|
||||
injectReactions(store, apolloClient);
|
||||
injectDefaultReactions(store, apolloClient);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
12
process/init/inject-reactions/default.js
Normal file
12
process/init/inject-reactions/default.js
Normal file
@ -0,0 +1,12 @@
|
||||
import * as agentsReactions from '../../agents/reactions';
|
||||
import * as calculateReactions from '../../calculate/reactions';
|
||||
import * as leadOpportunityReactions from '../../lead-opportunity/reactions';
|
||||
import paymentsReactions from '../../payments/reactions';
|
||||
|
||||
export default function injectDefaultReactions(store, apolloClient) {
|
||||
leadOpportunityReactions.common(store, apolloClient);
|
||||
leadOpportunityReactions.urls(store, apolloClient);
|
||||
paymentsReactions(store, apolloClient);
|
||||
calculateReactions.validation(store, apolloClient);
|
||||
agentsReactions.common(store, apolloClient);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user