ui: add link to api page

This commit is contained in:
undefined committed 2021-08-23 04:17:26 +08:00
1 parent 95be2f95a5
commit ebe0a08d3e
3 files changed
+9 -6

No files matched your search

+7 -4
View File
@@ -5,8 +5,12 @@ import { render } from 'react-dom';
import 'graphiql/graphiql.css';
const Logo = () => <span>Hydro API Console </span>;
// @ts-ignore
const defaultQuery = `\
query {
user(id: 1) {
uname
}
}`;
const page = new NamedPage('api', async () => {
const [{ default: GraphiQL }, { buildSchema }, res] = await Promise.all([
@@ -16,11 +20,10 @@ const page = new NamedPage('api', async () => {
]);
// @ts-ignore
GraphiQL.Logo = Logo;
console.log(res);
const App = () => (
<GraphiQL
schema={buildSchema(res.schema)}
style={{ height: '100vh' }}
defaultQuery={defaultQuery}
fetcher={async (graphQLParams) => {
const data = await fetch(
'/api',