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

21 lines
377 B
TypeScript

import { useQuery } from '@apollo/client';
import { IApp } from 'types';
import { GET_APP } from 'graphql/queries/get-app';
type QueryResponse = {
getApp: IApp;
};
export default function useApp(key: string) {
const { data, loading } = useQuery<QueryResponse>(GET_APP, {
variables: { key },
});
const app = data?.getApp;
return {
app,
loading,
};
}