@acrool/react-fetcher 0.0.2-alpha.11 → 0.0.2-alpha.14

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.
@@ -0,0 +1,12 @@
1
+ export declare enum ERequestContentType {
2
+ formData = "multipart/form-data",
3
+ formUrlDecode = "application/x-www-form-urlencoded",
4
+ json = "application/json"
5
+ }
6
+ export declare enum ERequestMethod {
7
+ GET = "GET",
8
+ POST = "POST",
9
+ PUT = "PUT",
10
+ DELETE = "DELETE",
11
+ PATCH = "PATCH"
12
+ }
@@ -1,2 +1,3 @@
1
1
  export { default as createRestFulFetcher } from './createRestFulFetcher';
2
- export type { IUseFetcherArgs as IUseRestFulFetcherArgs, TContentTypeResolver, ERequestHeaderContentType } from './types';
2
+ export type { IUseFetcherArgs as IUseRestFulFetcherArgs, TContentTypeResolver } from './types';
3
+ export * from './config';
@@ -1,4 +1,5 @@
1
1
  import { IRequestConfig } from '../types';
2
+ import { ERequestMethod } from './config';
2
3
  export type IUseFetcherArgs<TVariables> = TVariables | (TVariables & {
3
4
  fetchOptions?: IRequestConfig;
4
5
  });
@@ -8,9 +9,4 @@ export interface IDocument {
8
9
  }
9
10
  export type TFileMapVariables = Record<string, any>;
10
11
  export type TBody = Record<string, any> | FormData | File[] | File;
11
- export type TContentTypeResolver = (method: string) => string;
12
- export declare enum ERequestHeaderContentType {
13
- formData = "multipart/form-data",
14
- formUrlDecode = "application/x-www-form-urlencoded",
15
- json = "application/json"
16
- }
12
+ export type TContentTypeResolver = (method: ERequestMethod) => string;
@@ -1,10 +1,11 @@
1
- import { TBody, TContentTypeResolver, ERequestHeaderContentType } from './types';
1
+ import { ERequestContentType } from './config';
2
+ import { TBody, TContentTypeResolver } from './types';
2
3
  /**
3
4
  * 依據 Content-Type 處理 body
4
5
  * @param data
5
6
  * @param contentType
6
7
  */
7
- export declare const getDataWithContentType: (contentType: ERequestHeaderContentType, data?: TBody) => FormData | string;
8
+ export declare const getDataWithContentType: (contentType: ERequestContentType, data?: TBody) => FormData | string;
8
9
  /**
9
10
  * 根據 method 取得 Content-Type
10
11
  * @param method
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acrool/react-fetcher",
3
- "version": "0.0.2-alpha.11",
3
+ "version": "0.0.2-alpha.14",
4
4
  "description": "Fetcher library based for Reactjs",
5
5
  "keywords": [
6
6
  "acrool",