mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01: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
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.18.0",
|
"version": "4.18.1",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -5,8 +5,12 @@ import { render } from 'react-dom';
|
|||||||
import 'graphiql/graphiql.css';
|
import 'graphiql/graphiql.css';
|
||||||
|
|
||||||
const Logo = () => <span>Hydro API Console </span>;
|
const Logo = () => <span>Hydro API Console </span>;
|
||||||
|
const defaultQuery = `\
|
||||||
// @ts-ignore
|
query {
|
||||||
|
user(id: 1) {
|
||||||
|
uname
|
||||||
|
}
|
||||||
|
}`;
|
||||||
|
|
||||||
const page = new NamedPage('api', async () => {
|
const page = new NamedPage('api', async () => {
|
||||||
const [{ default: GraphiQL }, { buildSchema }, res] = await Promise.all([
|
const [{ default: GraphiQL }, { buildSchema }, res] = await Promise.all([
|
||||||
@@ -16,11 +20,10 @@ const page = new NamedPage('api', async () => {
|
|||||||
]);
|
]);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
GraphiQL.Logo = Logo;
|
GraphiQL.Logo = Logo;
|
||||||
console.log(res);
|
|
||||||
const App = () => (
|
const App = () => (
|
||||||
<GraphiQL
|
<GraphiQL
|
||||||
schema={buildSchema(res.schema)}
|
schema={buildSchema(res.schema)}
|
||||||
style={{ height: '100vh' }}
|
defaultQuery={defaultQuery}
|
||||||
fetcher={async (graphQLParams) => {
|
fetcher={async (graphQLParams) => {
|
||||||
const data = await fetch(
|
const data = await fetch(
|
||||||
'/api',
|
'/api',
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
</h1>
|
</h1>
|
||||||
<div class="footer__category__expander"><ul class="footer__category__list">
|
<div class="footer__category__expander"><ul class="footer__category__list">
|
||||||
<li class="footer__category__item"><a href="https://github.com/hydro-dev/Hydro" target="_blank">{{ _('Open Source') }}</a></li>
|
<li class="footer__category__item"><a href="https://github.com/hydro-dev/Hydro" target="_blank">{{ _('Open Source') }}</a></li>
|
||||||
<li class="footer__category__item"><a href="{{ url('wiki_api') }}">{{ _('API') }}</a></li>
|
<li class="footer__category__item"><a href="{{ url('api') }}">{{ _('API') }}</a></li>
|
||||||
</ul></div>
|
</ul></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="medium-3 large-2 columns footer__category expandable end">
|
<div class="medium-3 large-2 columns footer__category expandable end">
|
||||||
|
|||||||
Reference in new issue
Block a user