Fix adding header if not exist

This commit is contained in:
Gregory Schier
2024-03-10 17:10:16 -07:00
parent 9e065c34ee
commit c2dc7e0f4a
3 changed files with 25 additions and 35 deletions

View File

@@ -80,10 +80,14 @@ export function useIntrospectGraphQL(baseRequest: HttpRequest) {
setRefetchKey((k) => k + 1);
}, []);
const schema = useMemo(
() => (introspection ? buildClientSchema(introspection) : undefined),
[introspection],
);
const schema = useMemo(() => {
try {
return introspection ? buildClientSchema(introspection) : undefined;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (e: any) {
setError('message' in e ? e.message : String(e));
}
}, [introspection]);
return { schema, isLoading, error, refetch };
}