mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
Lint all files
This commit is contained in:
parent
22af76b4d6
commit
30e52ebb54
334 changed files with 76519 additions and 75932 deletions
|
|
@ -1,97 +1,97 @@
|
|||
import type {
|
||||
UseQueryOptions,
|
||||
DefaultOptions,
|
||||
UseMutationOptions,
|
||||
UseInfiniteQueryOptions,
|
||||
UseQueryOptions,
|
||||
DefaultOptions,
|
||||
UseMutationOptions,
|
||||
UseInfiniteQueryOptions,
|
||||
} from '@tanstack/react-query';
|
||||
import { QueryClient, QueryCache } from '@tanstack/react-query';
|
||||
import { toast } from '/@/renderer/components/toast/index';
|
||||
|
||||
const queryCache = new QueryCache({
|
||||
onError: (error: any, query) => {
|
||||
if (query.state.data !== undefined) {
|
||||
toast.show({ message: `${error.message}`, type: 'error' });
|
||||
}
|
||||
},
|
||||
onError: (error: any, query) => {
|
||||
if (query.state.data !== undefined) {
|
||||
toast.show({ message: `${error.message}`, type: 'error' });
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const queryConfig: DefaultOptions = {
|
||||
mutations: {
|
||||
retry: process.env.NODE_ENV === 'production',
|
||||
},
|
||||
queries: {
|
||||
cacheTime: 1000 * 60 * 3,
|
||||
onError: (err) => {
|
||||
console.error('react query error:', err);
|
||||
mutations: {
|
||||
retry: process.env.NODE_ENV === 'production',
|
||||
},
|
||||
refetchOnWindowFocus: false,
|
||||
retry: process.env.NODE_ENV === 'production',
|
||||
staleTime: 1000 * 5,
|
||||
useErrorBoundary: (error: any) => {
|
||||
return error?.response?.status >= 500;
|
||||
queries: {
|
||||
cacheTime: 1000 * 60 * 3,
|
||||
onError: (err) => {
|
||||
console.error('react query error:', err);
|
||||
},
|
||||
refetchOnWindowFocus: false,
|
||||
retry: process.env.NODE_ENV === 'production',
|
||||
staleTime: 1000 * 5,
|
||||
useErrorBoundary: (error: any) => {
|
||||
return error?.response?.status >= 500;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const queryClient = new QueryClient({
|
||||
defaultOptions: queryConfig,
|
||||
queryCache,
|
||||
defaultOptions: queryConfig,
|
||||
queryCache,
|
||||
});
|
||||
|
||||
export type QueryHookArgs<T> = {
|
||||
options?: QueryOptions;
|
||||
query: T;
|
||||
serverId: string | undefined;
|
||||
options?: QueryOptions;
|
||||
query: T;
|
||||
serverId: string | undefined;
|
||||
};
|
||||
|
||||
export type MutationHookArgs = {
|
||||
options?: MutationOptions;
|
||||
options?: MutationOptions;
|
||||
};
|
||||
|
||||
export type QueryOptions = {
|
||||
cacheTime?: UseQueryOptions['cacheTime'];
|
||||
enabled?: UseQueryOptions['enabled'];
|
||||
keepPreviousData?: UseQueryOptions['keepPreviousData'];
|
||||
meta?: UseQueryOptions['meta'];
|
||||
onError?: (err: any) => void;
|
||||
onSettled?: any;
|
||||
onSuccess?: any;
|
||||
queryKey?: UseQueryOptions['queryKey'];
|
||||
refetchInterval?: number;
|
||||
refetchIntervalInBackground?: UseQueryOptions['refetchIntervalInBackground'];
|
||||
refetchOnWindowFocus?: boolean;
|
||||
retry?: UseQueryOptions['retry'];
|
||||
retryDelay?: UseQueryOptions['retryDelay'];
|
||||
staleTime?: UseQueryOptions['staleTime'];
|
||||
suspense?: UseQueryOptions['suspense'];
|
||||
useErrorBoundary?: boolean;
|
||||
cacheTime?: UseQueryOptions['cacheTime'];
|
||||
enabled?: UseQueryOptions['enabled'];
|
||||
keepPreviousData?: UseQueryOptions['keepPreviousData'];
|
||||
meta?: UseQueryOptions['meta'];
|
||||
onError?: (err: any) => void;
|
||||
onSettled?: any;
|
||||
onSuccess?: any;
|
||||
queryKey?: UseQueryOptions['queryKey'];
|
||||
refetchInterval?: number;
|
||||
refetchIntervalInBackground?: UseQueryOptions['refetchIntervalInBackground'];
|
||||
refetchOnWindowFocus?: boolean;
|
||||
retry?: UseQueryOptions['retry'];
|
||||
retryDelay?: UseQueryOptions['retryDelay'];
|
||||
staleTime?: UseQueryOptions['staleTime'];
|
||||
suspense?: UseQueryOptions['suspense'];
|
||||
useErrorBoundary?: boolean;
|
||||
};
|
||||
|
||||
export type MutationOptions = {
|
||||
mutationKey: UseMutationOptions['mutationKey'];
|
||||
onError?: (err: any) => void;
|
||||
onSettled?: any;
|
||||
onSuccess?: any;
|
||||
retry?: UseQueryOptions['retry'];
|
||||
retryDelay?: UseQueryOptions['retryDelay'];
|
||||
useErrorBoundary?: boolean;
|
||||
mutationKey: UseMutationOptions['mutationKey'];
|
||||
onError?: (err: any) => void;
|
||||
onSettled?: any;
|
||||
onSuccess?: any;
|
||||
retry?: UseQueryOptions['retry'];
|
||||
retryDelay?: UseQueryOptions['retryDelay'];
|
||||
useErrorBoundary?: boolean;
|
||||
};
|
||||
|
||||
export type InfiniteQueryOptions = {
|
||||
cacheTime?: UseInfiniteQueryOptions['cacheTime'];
|
||||
enabled?: UseInfiniteQueryOptions['enabled'];
|
||||
keepPreviousData?: UseInfiniteQueryOptions['keepPreviousData'];
|
||||
meta?: UseInfiniteQueryOptions['meta'];
|
||||
onError?: (err: any) => void;
|
||||
onSettled?: any;
|
||||
onSuccess?: any;
|
||||
queryKey?: UseInfiniteQueryOptions['queryKey'];
|
||||
refetchInterval?: number;
|
||||
refetchIntervalInBackground?: UseInfiniteQueryOptions['refetchIntervalInBackground'];
|
||||
refetchOnWindowFocus?: boolean;
|
||||
retry?: UseInfiniteQueryOptions['retry'];
|
||||
retryDelay?: UseInfiniteQueryOptions['retryDelay'];
|
||||
staleTime?: UseInfiniteQueryOptions['staleTime'];
|
||||
suspense?: UseInfiniteQueryOptions['suspense'];
|
||||
useErrorBoundary?: boolean;
|
||||
cacheTime?: UseInfiniteQueryOptions['cacheTime'];
|
||||
enabled?: UseInfiniteQueryOptions['enabled'];
|
||||
keepPreviousData?: UseInfiniteQueryOptions['keepPreviousData'];
|
||||
meta?: UseInfiniteQueryOptions['meta'];
|
||||
onError?: (err: any) => void;
|
||||
onSettled?: any;
|
||||
onSuccess?: any;
|
||||
queryKey?: UseInfiniteQueryOptions['queryKey'];
|
||||
refetchInterval?: number;
|
||||
refetchIntervalInBackground?: UseInfiniteQueryOptions['refetchIntervalInBackground'];
|
||||
refetchOnWindowFocus?: boolean;
|
||||
retry?: UseInfiniteQueryOptions['retry'];
|
||||
retryDelay?: UseInfiniteQueryOptions['retryDelay'];
|
||||
staleTime?: UseInfiniteQueryOptions['staleTime'];
|
||||
suspense?: UseInfiniteQueryOptions['suspense'];
|
||||
useErrorBoundary?: boolean;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue