We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ffe0783 commit 2a75862Copy full SHA for 2a75862
javascripts/explorer.js
@@ -1,5 +1,15 @@
1
+const explorerUrl = process.env.NODE_ENV === 'production'
2
+ ? 'https://graphql.github.com/explorer'
3
+ : 'http://localhost:3000'
4
5
+// Pass non-search query params to Explorer app via the iFrame
6
export default function () {
- // TODO support "Run in Explorer" links in GraphQL guides
- // will need to handle query params separately from search queries
7
+ const graphiqlExplorer = document.getElementById('graphiql')
8
+ const queryString = window.location.search
9
+
10
+ if (!(queryString && graphiqlExplorer)) return
11
12
+ window.onload = () => {
13
+ graphiqlExplorer.contentWindow.postMessage(queryString, explorerUrl)
14
+ }
15
}
0 commit comments