|
|
@ -235,22 +235,36 @@ func GraphiQLHandler(auth_token string) func(http.ResponseWriter, *http.Request)
|
|
|
|
type="application/javascript"
|
|
|
|
type="application/javascript"
|
|
|
|
></script>
|
|
|
|
></script>
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
const root = ReactDOM.createRoot(document.getElementById('graphiql'));
|
|
|
|
if (window.authToken === undefined) {
|
|
|
|
root.render(
|
|
|
|
const root = ReactDOM.createRoot(document.getElementById('graphiql'));
|
|
|
|
React.createElement(GraphiQL, {
|
|
|
|
root.render(
|
|
|
|
fetcher: GraphiQL.createFetcher({
|
|
|
|
React.createElement(GraphiQL, {
|
|
|
|
url: '/gql',
|
|
|
|
fetcher: GraphiQL.createFetcher({
|
|
|
|
headers: {
|
|
|
|
url: '/gql',
|
|
|
|
"Authorization": "Basic %s",
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
defaultEditorToolsVisibility: true,
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
defaultEditorToolsVisibility: true,
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
} else {
|
|
|
|
);
|
|
|
|
authToken().then(function(res){
|
|
|
|
|
|
|
|
const root = ReactDOM.createRoot(document.getElementById('graphiql'));
|
|
|
|
|
|
|
|
root.render(
|
|
|
|
|
|
|
|
React.createElement(GraphiQL, {
|
|
|
|
|
|
|
|
fetcher: GraphiQL.createFetcher({
|
|
|
|
|
|
|
|
url: '/gql',
|
|
|
|
|
|
|
|
headers: {
|
|
|
|
|
|
|
|
"Authorization": ` + "`Basic ${res}`" + `,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
defaultEditorToolsVisibility: true,
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
</html>
|
|
|
|
`, auth_token)
|
|
|
|
`)
|
|
|
|
|
|
|
|
|
|
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|