-
-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de3e0dc
commit 5ea06f7
Showing
1 changed file
with
43 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,52 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<style> | ||
body { | ||
height: 100%; | ||
margin: 0; | ||
width: 100%; | ||
overflow: hidden; | ||
} | ||
#voyager { | ||
height: 100vh; | ||
} | ||
</style> | ||
|
||
<!-- | ||
<head> | ||
<style> | ||
body { | ||
height: 100%; | ||
margin: 0; | ||
width: 100%; | ||
overflow: hidden; | ||
} | ||
|
||
#voyager { | ||
height: 100vh; | ||
} | ||
</style> | ||
|
||
<!-- | ||
These two files are served from jsdelivr CDN, however you may wish to | ||
copy them directly into your environment, or perhaps include them in your | ||
favored resource bundler. | ||
--> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.css" | ||
/> | ||
<script src="https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.standalone.js"></script> | ||
</head> | ||
<body> | ||
<div id="voyager">Loading...</div> | ||
<script type="module"> | ||
const { init, voyagerIntrospectionQuery: query } = GraphQLVoyager; | ||
const response = await fetch( | ||
'https://swapi-graphql.netlify.app/.netlify/functions/index', | ||
{ | ||
method: 'post', | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ query }), | ||
credentials: 'omit', | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.css" /> | ||
<script src="https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.standalone.js"></script> | ||
</head> | ||
|
||
<body> | ||
<div id="voyager">Loading...</div> | ||
<script type="module"> | ||
const { voyagerIntrospectionQuery: query } = GraphQLVoyager; | ||
const response = await fetch( | ||
'https://swapi-graphql.netlify.app/.netlify/functions/index', | ||
{ | ||
method: 'post', | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
); | ||
const introspection = await response.json(); | ||
body: JSON.stringify({ query }), | ||
credentials: 'omit', | ||
}, | ||
); | ||
const introspection = await response.json(); | ||
|
||
// Render <Voyager /> into the body. | ||
GraphQLVoyager.renderVoyager(document.getElementById('voyager'), { | ||
introspection, | ||
}); | ||
</script> | ||
</body> | ||
|
||
// Render <Voyager /> into the body. | ||
GraphQLVoyager.init(document.getElementById('voyager'), { | ||
introspection, | ||
}); | ||
</script> | ||
</body> | ||
</html> | ||
</html> |