Skip to content

Commit

Permalink
fix: client side validation for router playground (wundergraph#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
JivusAyrus authored Jul 30, 2024
1 parent fd4ca77 commit 9a276d8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
29 changes: 13 additions & 16 deletions playground/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,24 +238,21 @@ export default function App() {
setIsMounted(true);
}, [isMounted]);

useEffect(() => {
const getSchema = async () => {
const res = await fetch(url, {
body: JSON.stringify({
operationName: 'IntrospectionQuery',
query: getIntrospectionQuery(),
}),
method: 'POST',
});
setSchema(buildClientSchema((await res.json()).data));
};

if (schema) {
return;
}
const getSchema = async () => {
const res = await fetch(url, {
body: JSON.stringify({
operationName: 'IntrospectionQuery',
query: getIntrospectionQuery(),
}),
method: 'POST',
headers: JSON.parse(headers),
});
setSchema(buildClientSchema((await res.json()).data));
};

useEffect(() => {
getSchema();
}, []);
}, [headers]);

const fetcher = useMemo(() => {
const onFetch = (response: any) => {
Expand Down
12 changes: 6 additions & 6 deletions router/internal/graphiql/graphiql.html

Large diffs are not rendered by default.

0 comments on commit 9a276d8

Please sign in to comment.