Use gql for "about"
This commit is contained in:
@@ -24,7 +24,6 @@ import { OperationVariables } from '@apollo/client/core';
|
|||||||
import {
|
import {
|
||||||
BackupValidationResult,
|
BackupValidationResult,
|
||||||
BatchChaptersChange,
|
BatchChaptersChange,
|
||||||
IAbout,
|
|
||||||
ICategory,
|
ICategory,
|
||||||
IChapter,
|
IChapter,
|
||||||
IExtension,
|
IExtension,
|
||||||
@@ -44,6 +43,8 @@ import { HttpMethod as DefaultHttpMethod, IRestClient, RestClient } from '@/lib/
|
|||||||
import storage from '@/util/localStorage.tsx';
|
import storage from '@/util/localStorage.tsx';
|
||||||
import { GraphQLClient } from '@/lib/requests/client/GraphQLClient.ts';
|
import { GraphQLClient } from '@/lib/requests/client/GraphQLClient.ts';
|
||||||
import {
|
import {
|
||||||
|
GetAboutQuery,
|
||||||
|
GetAboutQueryVariables,
|
||||||
GetGlobalMetadatasQuery,
|
GetGlobalMetadatasQuery,
|
||||||
GetGlobalMetadatasQueryVariables,
|
GetGlobalMetadatasQueryVariables,
|
||||||
SetGlobalMetadataMutation,
|
SetGlobalMetadataMutation,
|
||||||
@@ -51,6 +52,7 @@ import {
|
|||||||
} from '@/lib/graphql/generated/graphql.ts';
|
} from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { GET_GLOBAL_METADATA, GET_GLOBAL_METADATAS } from '@/lib/graphql/queries/GlobalMetadataQuery.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 { SET_GLOBAL_METADATA } from '@/lib/graphql/mutations/GlobalMetadataMutation.ts';
|
||||||
|
import { GET_ABOUT } from '@/lib/graphql/queries/ServerInfoQuery.ts';
|
||||||
|
|
||||||
enum SWRHttpMethod {
|
enum SWRHttpMethod {
|
||||||
SWR_GET,
|
SWR_GET,
|
||||||
@@ -445,8 +447,10 @@ export class RequestManager {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public useGetAbout(swrOptions?: SWROptions<IAbout>): AbortableSWRResponse<IAbout> {
|
public useGetAbout(
|
||||||
return this.doRequest(HttpMethod.SWR_GET, 'settings/about', { swrOptions });
|
options?: QueryHookOptions<GetAboutQuery, GetAboutQueryVariables>,
|
||||||
|
): AbortableApolloUseQueryResponse<GetAboutQuery, GetAboutQueryVariables> {
|
||||||
|
return this.doRequestNew(GQLMethod.USE_QUERY, GET_ABOUT, {}, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public useCheckForUpdate(swrOptions?: SWROptions<UpdateCheck[]>): AbortableSWRResponse<UpdateCheck[]> {
|
public useCheckForUpdate(swrOptions?: SWROptions<UpdateCheck[]>): AbortableSWRResponse<UpdateCheck[]> {
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ export default function About() {
|
|||||||
setAction(null);
|
setAction(null);
|
||||||
}, [t]);
|
}, [t]);
|
||||||
|
|
||||||
const { data: about } = requestManager.useGetAbout();
|
const { data } = requestManager.useGetAbout();
|
||||||
|
const about = data?.about;
|
||||||
|
|
||||||
useSetDefaultBackTo('settings');
|
useSetDefaultBackTo('settings');
|
||||||
|
|
||||||
|
|||||||
@@ -253,16 +253,6 @@ export interface IReaderProps {
|
|||||||
prevChapter: () => void;
|
prevChapter: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IAbout {
|
|
||||||
name: string;
|
|
||||||
version: string;
|
|
||||||
revision: string;
|
|
||||||
buildType: 'Stable' | 'Preview';
|
|
||||||
buildTime: number;
|
|
||||||
github: string;
|
|
||||||
discord: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IDownloadChapter {
|
export interface IDownloadChapter {
|
||||||
chapterIndex: number;
|
chapterIndex: number;
|
||||||
mangaId: number;
|
mangaId: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user