Files
automatisch/packages/web/src/hooks/useAppConfig.ee.ts
2024-01-15 13:30:48 +01:00

22 lines
479 B
TypeScript

import { useQuery } from '@apollo/client';
import { AppConfig } from 'types';
import { GET_APP_CONFIG } from 'graphql/queries/get-app-config.ee';
type QueryResponse = {
getAppConfig: AppConfig;
};
export default function useAppConfig(key: string) {
const { data, loading } = useQuery<QueryResponse>(GET_APP_CONFIG, {
variables: { key },
context: { autoSnackbar: false },
});
const appConfig = data?.getAppConfig;
return {
appConfig,
loading,
};
}