v0.7.4
This commit is contained in:
Vendored
+40
-1
@@ -1,8 +1,47 @@
|
||||
import * as axios from 'axios';
|
||||
import * as Request from 'ff-request';
|
||||
import Request__default from 'ff-request';
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
import React from 'react';
|
||||
|
||||
declare const _default$3: any;
|
||||
|
||||
declare const _default$2: any;
|
||||
declare const _default$2: Http & Request__default;
|
||||
|
||||
/**
|
||||
* 应用统一的 HTTP 客户端单例;自身只实现 init/driver/headers/mock/unmock,
|
||||
* 其余属性通过 Proxy 代理到内部的 ff-request 实例(HttpRequest),
|
||||
* 所以 get/post/del 等请求方法可以直接在这个单例上调用
|
||||
*/
|
||||
declare class Http {
|
||||
static "__#private@#instance": any;
|
||||
static "__#private@#core": any;
|
||||
/** @returns {Http & import('ff-request').default} 单例实例 */
|
||||
static getInstance: () => Http & Request.default;
|
||||
appUrl: string;
|
||||
/**
|
||||
* 初始化(设置请求 baseURL/超时,并初始化内部 ff-request 实例)
|
||||
* @param {string} appKey
|
||||
* @param {string} appSecret
|
||||
* @param {string} appUrl 接口请求的 baseURL
|
||||
*/
|
||||
init(appKey: string, appSecret: string, appUrl: string): void;
|
||||
get driver(): axios.AxiosStatic;
|
||||
get headers(): Readonly<{
|
||||
Platform: "web";
|
||||
SaaS: string;
|
||||
Authorization: `Bearer ${string} `;
|
||||
}>;
|
||||
/**
|
||||
* 开启请求 mock(基于 axios-mock-adapter),未匹配的请求会透传到真实接口
|
||||
* @param {Object} [opt] 传给 MockAdapter 的选项
|
||||
* @returns {MockAdapter} mock 适配器实例,用于注册具体的 mock 规则
|
||||
*/
|
||||
mock(opt?: any): MockAdapter;
|
||||
/** 关闭并清除 mock */
|
||||
unmock(): void;
|
||||
#private;
|
||||
}
|
||||
|
||||
declare class Cache {
|
||||
constructor(target: any, fn: any);
|
||||
|
||||
Reference in New Issue
Block a user