core&ui: drop graphql apis

This commit is contained in:
undefined authored and GitHub committed 2025-04-29 15:02:20 +01:00
1 parent 0f7961d675
commit 6e16d03f67
52 files changed
+485 -583

No files matched your search

-10
View File
@@ -1,10 +0,0 @@
.graphiql-container .doc-explorer-title, .graphiql-container .history-title
overflow: hidden;
padding: 5px 40px 0px 0px !important
.graphiql-container .docExplorerWrap
font-family: var(--code-font-family) !important
.graphiql-container .doc-explorer-back
overflow: hidden;
padding: 8px 20px 0px 20px !important
-29
View File
@@ -1,29 +0,0 @@
import { pick } from 'lodash';
import React from 'react';
import { createRoot } from 'react-dom/client';
import { NamedPage } from 'vj/misc/Page';
import { request } from 'vj/utils';
const defaultQuery = `\
query Example(
$name: String!
) {
user(uname: $name) {
_id
uname
}
}`;
export default new NamedPage('api', async () => {
const { GraphiQL } = await import('graphiql');
GraphiQL.Logo = function () {
return <p></p>;
} as any;
createRoot(document.getElementById('main')!).render(
<GraphiQL
fetcher={(body, opts = {}) => request.post(`/d/${UiContext.domain._id}/api`, body, pick(opts, 'headers'))}
defaultQuery={defaultQuery}
variables='{"name": "Hydro"}'
/>,
);
});
+9 -12
View File
@@ -5,22 +5,19 @@ import { ActionDialog, ConfirmDialog } from 'vj/components/dialog';
import Notification from 'vj/components/notification';
import { NamedPage } from 'vj/misc/Page';
import {
api, delay, gql, i18n, tpl,
api, delay, i18n, tpl,
} from 'vj/utils';
function update(name: string, uids: number[]) {
return api(gql`
domain { manage { group {
update(name: ${name}, uids: ${uids})
} } }
`);
function update(name: string, uids: number[] = []) {
return api('domain.group', {
name,
uids,
}, []);
}
function del(name: string) {
return api(gql`
domain { manage { group {
del(name: ${name})
} } }
`);
return api('domain.group', {
name,
}, []);
}
const page = new NamedPage('domain_group', () => {
@@ -5,7 +5,7 @@ import VjNotification from 'vj/components/notification';
import selectUser from 'vj/components/selectUser';
import { ctx, Service } from 'vj/context';
import { NamedPage } from 'vj/misc/Page';
import { api, gql, loadReactRedux } from 'vj/utils';
import { api, loadReactRedux } from 'vj/utils';
class MessagePadService extends Service {
WebSocket: typeof import('../components/socket').default;
@@ -91,14 +91,10 @@ const page = new NamedPage('home_messages', () => {
async function loadSendTarget() {
const target = new URL(window.location.href).searchParams.get('target');
if (!target) return;
const user = await api(gql`
users(search: ${target}, exact: true) {
_id
uname
avatarUrl
mail
}
`, ['data', 'users']);
const user = await api(
'users', { search: target, exact: true },
['_id', 'uname', 'avatarUrl', 'mail'],
);
if (!user?.length) return;
createDialog(user[0]);
}