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

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.18.0",
"version": "4.18.1",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",
+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',
@@ -24,7 +24,7 @@
</h1>
<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="{{ url('wiki_api') }}">{{ _('API') }}</a></li>
<li class="footer__category__item"><a href="{{ url('api') }}">{{ _('API') }}</a></li>
</ul></div>
</div>
<div class="medium-3 large-2 columns footer__category expandable end">