@acrool/react-fetcher 0.0.8 → 0.0.9
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 { IRequestConfig } from '../types';
|
|
2
|
-
import { ERequestMethod } from './config';
|
|
2
|
+
import { ERequestContentType, ERequestMethod } from './config';
|
|
3
3
|
export type IRestFulEndpointsQueryReturn<TVariables> = TVariables extends void ? void | {
|
|
4
4
|
fetchOptions?: IRequestConfig;
|
|
5
5
|
} : {
|
|
@@ -20,7 +20,7 @@ export interface IDocument {
|
|
|
20
20
|
}
|
|
21
21
|
export type TFileMapVariables = Record<string, any>;
|
|
22
22
|
export type TBody = Record<string, any> | FormData | File[] | File;
|
|
23
|
-
export type TContentTypeResolver = (method: ERequestMethod) =>
|
|
23
|
+
export type TContentTypeResolver = (method: ERequestMethod) => ERequestContentType;
|
|
24
24
|
export interface ICreateRestFulOptions {
|
|
25
25
|
contentTypeResolver?: TContentTypeResolver;
|
|
26
26
|
fetcherLeastTime?: number;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { ERequestContentType } from './config';
|
|
2
|
-
import { TBody
|
|
2
|
+
import { TBody } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* 依據 Content-Type 處理 body
|
|
5
5
|
* @param data
|
|
6
6
|
* @param contentType
|
|
7
7
|
*/
|
|
8
8
|
export declare const getDataWithContentType: (contentType: ERequestContentType, data?: TBody) => FormData | string;
|
|
9
|
-
/**
|
|
10
|
-
* 根據 method 取得 Content-Type
|
|
11
|
-
* @param method
|
|
12
|
-
*/
|
|
13
|
-
export declare const getContentTypeWithMethod: TContentTypeResolver;
|