File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
servers/graphql-kotlin-spring-server/src/main/resources Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change 52
52
< div id ="graphiql "> Loading...</ div >
53
53
< script
54
54
src ="https://unpkg.com/graphiql/graphiql.min.js "
55
- type ="application/javascript "
55
+ integrity ="sha512-FVCV2//UVo1qJ3Kg6kkHLe0Hg+IJhjrGa+aYHh8xD4KmwbbjthIzvaAcCJsQgA43+k+6u7HqORKXMyMt82Srfw== "
56
+ crossorigin ="anonymous "
57
+ > </ script >
58
+ < script
59
+ src ="https://unpkg.com/@graphiql/plugin-explorer@0.1.12/dist/graphiql-plugin-explorer.umd.js "
60
+ integrity ="sha512-Fjas/uSkzvsFjbv4jqU9nt4ulU7LDjiMAXW2YFTYD96NgKS1fhhAsGR4b2k2VaVLsE29aia3vyobAq9TNzusvA== "
61
+ crossorigin ="anonymous "
56
62
> </ script >
57
63
< script >
58
- ReactDOM . render (
59
- React . createElement ( GraphiQL , {
64
+ function GraphiQLWithExplorer ( ) {
65
+ var [ query , setQuery ] = React . useState ( '' ) ;
66
+ var explorerPlugin = GraphiQLPluginExplorer . useExplorerPlugin ( {
67
+ query : query ,
68
+ onEdit : setQuery ,
69
+ } ) ;
70
+ return React . createElement ( GraphiQL , {
60
71
fetcher : GraphiQL . createFetcher ( {
61
72
url : '/${graphQLEndpoint}' ,
62
73
subscriptionUrl : '/${subscriptionsEndpoint}'
63
74
} ) ,
64
75
defaultEditorToolsVisibility : true ,
65
- } ) ,
76
+ plugins : [ explorerPlugin ] ,
77
+ query : query ,
78
+ onEditQuery : setQuery ,
79
+ } ) ;
80
+ }
81
+ ReactDOM . render (
82
+ React . createElement ( GraphiQLWithExplorer ) ,
66
83
document . getElementById ( 'graphiql' ) ,
67
84
) ;
68
85
</ script >
You can’t perform that action at this time.
0 commit comments