mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-17 06:12:02 +00:00
23 lines
669 B
TypeScript
23 lines
669 B
TypeScript
![]() |
import React from 'react';
|
||
|
import './App.less';
|
||
|
import { AppConfigContext, DEFAULT_APP_CONFIG } from './appConfigContext';
|
||
|
import { useAppConfigQuery } from './graphql/app.generated';
|
||
|
|
||
|
const AppConfigProvider = ({ children }: { children: React.ReactNode }) => {
|
||
|
const { data: appConfigData, refetch } = useAppConfigQuery();
|
||
|
|
||
|
const refreshAppConfig = () => {
|
||
|
refetch();
|
||
|
};
|
||
|
|
||
|
return (
|
||
|
<AppConfigContext.Provider
|
||
|
value={{ config: appConfigData?.appConfig || DEFAULT_APP_CONFIG, refreshContext: refreshAppConfig }}
|
||
|
>
|
||
|
{children}
|
||
|
</AppConfigContext.Provider>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default AppConfigProvider;
|