refactor: remove AutomatischInfo context
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import { useQuery } from '@apollo/client';
|
||||
import { GET_AUTOMATISCH_INFO } from 'graphql/queries/get-automatisch-info';
|
||||
export const AutomatischInfoContext = React.createContext({
|
||||
isCloud: false,
|
||||
isMation: false,
|
||||
loading: true,
|
||||
});
|
||||
export const AutomatischInfoProvider = (props) => {
|
||||
const { children } = props;
|
||||
const { data, loading } = useQuery(GET_AUTOMATISCH_INFO);
|
||||
const isCloud = data?.getAutomatischInfo?.isCloud;
|
||||
const isMation = data?.getAutomatischInfo?.isMation;
|
||||
const value = React.useMemo(() => {
|
||||
return {
|
||||
isCloud,
|
||||
isMation,
|
||||
loading,
|
||||
};
|
||||
}, [isCloud, isMation, loading]);
|
||||
return (
|
||||
<AutomatischInfoContext.Provider value={value}>
|
||||
{children}
|
||||
</AutomatischInfoContext.Provider>
|
||||
);
|
||||
};
|
@@ -5,7 +5,6 @@ import ApolloProvider from 'components/ApolloProvider';
|
||||
import SnackbarProvider from 'components/SnackbarProvider';
|
||||
import MetadataProvider from 'components/MetadataProvider';
|
||||
import { AuthenticationProvider } from 'contexts/Authentication';
|
||||
import { AutomatischInfoProvider } from 'contexts/AutomatischInfo';
|
||||
import QueryClientProvider from 'components/QueryClientProvider';
|
||||
import Router from 'components/Router';
|
||||
import LiveChat from 'components/LiveChat/index.ee';
|
||||
@@ -21,17 +20,15 @@ root.render(
|
||||
<AuthenticationProvider>
|
||||
<QueryClientProvider>
|
||||
<ApolloProvider>
|
||||
<AutomatischInfoProvider>
|
||||
<IntlProvider>
|
||||
<ThemeProvider>
|
||||
<MetadataProvider>
|
||||
{routes}
|
||||
<IntlProvider>
|
||||
<ThemeProvider>
|
||||
<MetadataProvider>
|
||||
{routes}
|
||||
|
||||
<LiveChat />
|
||||
</MetadataProvider>
|
||||
</ThemeProvider>
|
||||
</IntlProvider>
|
||||
</AutomatischInfoProvider>
|
||||
<LiveChat />
|
||||
</MetadataProvider>
|
||||
</ThemeProvider>
|
||||
</IntlProvider>
|
||||
</ApolloProvider>
|
||||
</QueryClientProvider>
|
||||
</AuthenticationProvider>
|
||||
|
Reference in New Issue
Block a user