1 | import 'isomorphic-fetch';
|
2 | export interface IResponse<T> {
|
3 | ok: boolean;
|
4 | status: number;
|
5 | statusText?: string;
|
6 | type: string;
|
7 | url: string;
|
8 | data?: T;
|
9 | }
|
10 | export interface IHttpHeaders {
|
11 | [id: string]: string;
|
12 | }
|
13 | declare function get<T>(url: string, headers?: IHttpHeaders): Promise<IResponse<T>>;
|
14 | declare function put<T>(url: string, data?: object, headers?: IHttpHeaders): Promise<IResponse<T>>;
|
15 | declare function post<T>(url: string, data?: object, headers?: IHttpHeaders): Promise<IResponse<T>>;
|
16 | declare function patch<T>(url: string, data?: object, headers?: IHttpHeaders): Promise<IResponse<T>>;
|
17 | declare function del<T>(url: string, headers?: IHttpHeaders): Promise<IResponse<T>>;
|
18 | declare function headers(httpHeaders: IHttpHeaders): {
|
19 | get: <T>(url: string) => Promise<IResponse<T>>;
|
20 | put: <T>(url: string, data?: object | undefined) => Promise<IResponse<T>>;
|
21 | post: <T>(url: string, data?: object | undefined) => Promise<IResponse<T>>;
|
22 | patch: <T>(url: string, data?: object | undefined) => Promise<IResponse<T>>;
|
23 | delete: <T>(url: string) => Promise<IResponse<T>>;
|
24 | headers: (append: IHttpHeaders) => any;
|
25 | };
|
26 | export { get, put, post, patch, del as delete, headers };
|
27 | declare const _default: {
|
28 | get: typeof get;
|
29 | put: typeof put;
|
30 | post: typeof post;
|
31 | patch: typeof patch;
|
32 | delete: typeof del;
|
33 | headers: typeof headers;
|
34 | };
|
35 | export default _default;
|