mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
Added graphql docs endpoint.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import {GraphQLDocs} from 'graphql-docs';
|
||||
|
||||
import fetcher from './services/fetcher';
|
||||
|
||||
// Render the application into the DOM
|
||||
ReactDOM.render(<div className='wrapper'>
|
||||
<h1>Talk: GraphQL Docs</h1>
|
||||
<GraphQLDocs fetcher={fetcher} />
|
||||
</div>, document.querySelector('#root'));
|
||||
@@ -0,0 +1,10 @@
|
||||
export default function fetcher(query) {
|
||||
return fetch(`${window.location.origin}/api/v1/graph/ql`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({query}),
|
||||
}).then((res) => res.json());
|
||||
}
|
||||
Reference in New Issue
Block a user