1 |
|
2 |
|
3 |
|
4 |
|
5 | import { DicType } from '../../config/index';
|
6 | declare type PostOptionType<T> = {
|
7 | timeout?: number;
|
8 | formData?: FormData;
|
9 | headers?: DicType;
|
10 | withCredentials?: boolean;
|
11 | onTimeout?: (xhr: XMLHttpRequest) => void;
|
12 | onProgress?: (percent: number, event: ProgressEvent) => void;
|
13 | beforeSend?: (xhr: XMLHttpRequest) => {
|
14 | prevent: boolean;
|
15 | msg: string;
|
16 | } | void;
|
17 | onError?: (xhr: XMLHttpRequest) => void;
|
18 | onFail?: (xhr: XMLHttpRequest, msg: string) => void;
|
19 | onSuccess: (xhr: XMLHttpRequest, result: T) => void;
|
20 | };
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | declare function post<T extends Object>(url: string, option: PostOptionType<T>): XMLHttpRequest | string;
|
27 | export default post;
|