mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ui: add link to api page
This commit is contained in:
1 parent
95be2f95a5
commit
ebe0a08d3e
3 files changed
+9
-6
No files matched your search
@@ -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',
|
||||
|
||||
Reference in new issue
Block a user