@acrool/react-fetcher 0.0.4-test.0 → 0.0.4-test.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { IDocument, IUseRestFulFetcherArgs, TContentTypeResolver } from './types';
|
|
2
|
+
import { IDocument, IUseRestFulFetcherArgs, TContentTypeResolver, TFileMapVariables } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* RestFul 的查詢器
|
|
5
5
|
* https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-react-query#usage-example-isreacthook-true
|
|
@@ -7,5 +7,5 @@ import { IDocument, IUseRestFulFetcherArgs, TContentTypeResolver } from './types
|
|
|
7
7
|
* @param document
|
|
8
8
|
* @param contentTypeResolver
|
|
9
9
|
*/
|
|
10
|
-
declare const createRestFulFetcher: <TData, TArgs extends IUseRestFulFetcherArgs
|
|
10
|
+
declare const createRestFulFetcher: <TData, TArgs extends IUseRestFulFetcherArgs<TFileMapVariables>>(axiosInstance: AxiosInstance, document: IDocument, contentTypeResolver?: TContentTypeResolver) => ((args?: TArgs) => Promise<TData>);
|
|
11
11
|
export default createRestFulFetcher;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IRequestConfig } from '../types';
|
|
2
2
|
import { ERequestMethod } from './config';
|
|
3
|
-
export type IUseRestFulFetcherArgs<TVariables
|
|
3
|
+
export type IUseRestFulFetcherArgs<TVariables> = TVariables extends void ? void | {
|
|
4
4
|
fetchOptions?: IRequestConfig;
|
|
5
5
|
} : {
|
|
6
|
-
variables
|
|
6
|
+
variables?: TVariables;
|
|
7
7
|
fetchOptions?: IRequestConfig;
|
|
8
8
|
};
|
|
9
9
|
export interface IDocument {
|