File tree Expand file tree Collapse file tree 1 file changed +13
-20
lines changed
Expand file tree Collapse file tree 1 file changed +13
-20
lines changed Original file line number Diff line number Diff line change @@ -3,33 +3,26 @@ import * as ReactDOMClient from 'react-dom/client';
33
44import { Voyager } from 'graphql-voyager' ;
55
6- class Test extends React . Component {
7- constructor ( ) {
8- super ( ) ;
9- }
10-
11- render ( ) {
12- return (
13- < Voyager
14- introspection = { this . introspectionProvider }
15- displayOptions = { { skipRelay : false , showLeafFields : true } }
16- />
17- ) ;
18- }
19-
20- async introspectionProvider ( query ) {
21- const response = await fetch ( 'https://swapi-graphql.netlify.app/.netlify/functions/index' , {
6+ async function introspectionProvider ( query ) {
7+ const response = await fetch (
8+ 'https://swapi-graphql.netlify.app/.netlify/functions/index' ,
9+ {
2210 method : 'post' ,
2311 headers : {
2412 Accept : 'application/json' ,
2513 'Content-Type' : 'application/json' ,
2614 } ,
2715 body : JSON . stringify ( { query } ) ,
2816 credentials : 'omit' ,
29- } ) ;
30- return response . json ( ) ;
31- }
17+ } ,
18+ ) ;
19+ return response . json ( ) ;
3220}
3321
3422const reactRoot = ReactDOMClient . createRoot ( document . getElementById ( 'voyager' ) ) ;
35- reactRoot . render ( < Test /> ) ;
23+ reactRoot . render (
24+ < Voyager
25+ introspection = { introspectionProvider }
26+ displayOptions = { { skipRelay : false , showLeafFields : true } }
27+ /> ,
28+ ) ;
You can’t perform that action at this time.
0 commit comments