File tree 1 file changed +13
-20
lines changed
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';
3
3
4
4
import { Voyager } from 'graphql-voyager' ;
5
5
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
+ {
22
10
method : 'post' ,
23
11
headers : {
24
12
Accept : 'application/json' ,
25
13
'Content-Type' : 'application/json' ,
26
14
} ,
27
15
body : JSON . stringify ( { query } ) ,
28
16
credentials : 'omit' ,
29
- } ) ;
30
- return response . json ( ) ;
31
- }
17
+ } ,
18
+ ) ;
19
+ return response . json ( ) ;
32
20
}
33
21
34
22
const 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