|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -import { API_STATUS_CODES, FALLBACK_REQUEST_TIMEOUT, Host, SERVICE_PATHS } from '@Common/Constants' |
| 17 | +import { API_STATUS_CODES, FALLBACK_REQUEST_TIMEOUT, Host } from '@Common/Constants' |
18 | 18 | import { noop } from '@Common/Helper' |
19 | 19 | import { ServerErrors } from '@Common/ServerError' |
20 | 20 | import { APIOptions, ResponseType } from '@Common/Types' |
@@ -69,7 +69,7 @@ class CoreAPI { |
69 | 69 | } else { |
70 | 70 | currentUrl = `${this.host}/${url}` |
71 | 71 | } |
72 | | - |
| 72 | + |
73 | 73 | return fetch( |
74 | 74 | currentUrl, |
75 | 75 | !isMultipartRequest |
@@ -281,19 +281,32 @@ class CoreAPI { |
281 | 281 | options?: APIOptions, |
282 | 282 | isMultipartRequest?: boolean, |
283 | 283 | isProxyHost?: boolean, |
284 | | - ): Promise<ResponseType<T>> => this.fetchInTime<K>({ url, type: 'POST', data, options, isMultipartRequest, isProxyHost }) |
| 284 | + ): Promise<ResponseType<T>> => |
| 285 | + this.fetchInTime<K>({ url, type: 'POST', data, options, isMultipartRequest, isProxyHost }) |
285 | 286 |
|
286 | | - put = <T = any, K = object>(url: string, data: K, options?: APIOptions, isProxyHost?: boolean): Promise<ResponseType<T>> => |
287 | | - this.fetchInTime<K>({ url, type: 'PUT', data, options, isProxyHost }) |
| 287 | + put = <T = any, K = object>( |
| 288 | + url: string, |
| 289 | + data: K, |
| 290 | + options?: APIOptions, |
| 291 | + isProxyHost?: boolean, |
| 292 | + ): Promise<ResponseType<T>> => this.fetchInTime<K>({ url, type: 'PUT', data, options, isProxyHost }) |
288 | 293 |
|
289 | | - patch = <T = any, K = object>(url: string, data: K, options?: APIOptions, isProxyHost?: boolean): Promise<ResponseType<T>> => |
290 | | - this.fetchInTime<K>({ url, type: 'PATCH', data, options, isProxyHost }) |
| 294 | + patch = <T = any, K = object>( |
| 295 | + url: string, |
| 296 | + data: K, |
| 297 | + options?: APIOptions, |
| 298 | + isProxyHost?: boolean, |
| 299 | + ): Promise<ResponseType<T>> => this.fetchInTime<K>({ url, type: 'PATCH', data, options, isProxyHost }) |
291 | 300 |
|
292 | 301 | get = <T = any>(url: string, options?: APIOptions, isProxyHost?: boolean): Promise<ResponseType<T>> => |
293 | 302 | this.fetchInTime({ url, type: 'GET', data: null, options, isProxyHost }) |
294 | 303 |
|
295 | | - trash = <T = any, K = object>(url: string, data?: K, options?: APIOptions, isProxyHost?: boolean): Promise<ResponseType<T>> => |
296 | | - this.fetchInTime<K>({ url, type: 'DELETE', data, options, isProxyHost }) |
| 304 | + trash = <T = any, K = object>( |
| 305 | + url: string, |
| 306 | + data?: K, |
| 307 | + options?: APIOptions, |
| 308 | + isProxyHost?: boolean, |
| 309 | + ): Promise<ResponseType<T>> => this.fetchInTime<K>({ url, type: 'DELETE', data, options, isProxyHost }) |
297 | 310 |
|
298 | 311 | setGlobalAPITimeout = (timeout: number) => { |
299 | 312 | this.timeout = timeout || FALLBACK_REQUEST_TIMEOUT |
|
0 commit comments