Use gql for "about"

This commit is contained in:
schroda
2023-09-01 20:25:46 +02:00
parent 80cb06dfd5
commit 59468bc568
3 changed files with 9 additions and 14 deletions

View File

@@ -24,7 +24,6 @@ import { OperationVariables } from '@apollo/client/core';
import {
BackupValidationResult,
BatchChaptersChange,
IAbout,
ICategory,
IChapter,
IExtension,
@@ -44,6 +43,8 @@ import { HttpMethod as DefaultHttpMethod, IRestClient, RestClient } from '@/lib/
import storage from '@/util/localStorage.tsx';
import { GraphQLClient } from '@/lib/requests/client/GraphQLClient.ts';
import {
GetAboutQuery,
GetAboutQueryVariables,
GetGlobalMetadatasQuery,
GetGlobalMetadatasQueryVariables,
SetGlobalMetadataMutation,
@@ -51,6 +52,7 @@ import {
} from '@/lib/graphql/generated/graphql.ts';
import { GET_GLOBAL_METADATA, GET_GLOBAL_METADATAS } from '@/lib/graphql/queries/GlobalMetadataQuery.ts';
import { SET_GLOBAL_METADATA } from '@/lib/graphql/mutations/GlobalMetadataMutation.ts';
import { GET_ABOUT } from '@/lib/graphql/queries/ServerInfoQuery.ts';
enum SWRHttpMethod {
SWR_GET,
@@ -445,8 +447,10 @@ export class RequestManager {
);
}
public useGetAbout(swrOptions?: SWROptions<IAbout>): AbortableSWRResponse<IAbout> {
return this.doRequest(HttpMethod.SWR_GET, 'settings/about', { swrOptions });
public useGetAbout(
options?: QueryHookOptions<GetAboutQuery, GetAboutQueryVariables>,
): AbortableApolloUseQueryResponse<GetAboutQuery, GetAboutQueryVariables> {
return this.doRequestNew(GQLMethod.USE_QUERY, GET_ABOUT, {}, options);
}
public useCheckForUpdate(swrOptions?: SWROptions<UpdateCheck[]>): AbortableSWRResponse<UpdateCheck[]> {

View File

@@ -25,7 +25,8 @@ export default function About() {
setAction(null);
}, [t]);
const { data: about } = requestManager.useGetAbout();
const { data } = requestManager.useGetAbout();
const about = data?.about;
useSetDefaultBackTo('settings');

View File

@@ -253,16 +253,6 @@ export interface IReaderProps {
prevChapter: () => void;
}
export interface IAbout {
name: string;
version: string;
revision: string;
buildType: 'Stable' | 'Preview';
buildTime: number;
github: string;
discord: string;
}
export interface IDownloadChapter {
chapterIndex: number;
mangaId: number;