feat: introduce app configs with shared auth clients (#1213)
This commit is contained in:
27
packages/web/src/hooks/useAppConfig.ee.ts
Normal file
27
packages/web/src/hooks/useAppConfig.ee.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { useQuery } from '@apollo/client';
|
||||
import { AppConfig } from '@automatisch/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,
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user