refactor: remove AutomatischInfo context

This commit is contained in:
Ali BARIN
2024-02-29 18:01:29 +00:00
parent 14c04ee4ac
commit 70af7d05e3
2 changed files with 8 additions and 37 deletions

View File

@@ -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>
);
};