submit
This commit is contained in:
parent
0377ab7775
commit
b2a0e35609
@ -21,12 +21,11 @@ type HttpMethod =
|
||||
| 'connect';
|
||||
interface RequestOptions {
|
||||
baseUrl?: string;
|
||||
dataType?: string;
|
||||
url: string;
|
||||
data?: Record<string, any>;
|
||||
method?: HttpMethod;
|
||||
header?: Record<string, string>;
|
||||
params?: Record<string, any>; // 新增的参数字段
|
||||
params?: Record<string, any>;
|
||||
}
|
||||
type RequestInterceptor = (config: RequestOptions) => RequestOptions;
|
||||
type ResponseInterceptor = (response: any) => any;
|
||||
@ -62,7 +61,6 @@ class uniFetch {
|
||||
request(options: RequestOptions): Promise<any> {
|
||||
options = options || {};
|
||||
options.baseUrl = options.baseUrl || this.baseUrl;
|
||||
options.dataType = options.dataType || "json";
|
||||
options.url = options.baseUrl + options.url;
|
||||
options.data = options.data || {};
|
||||
options.method = options.method || "GET";
|
||||
@ -100,7 +98,6 @@ class uniFetch {
|
||||
}
|
||||
|
||||
private handleError(error: any): any {
|
||||
// 在这里处理错误
|
||||
throw error;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user