gov-api
v1.0.12
Published
```ts import govApi from 'gov-api';
Downloads
5
Readme
用法
import govApi from 'gov-api';
const apiService = govApi(apiOptions, config: { baseUrl: string});
apiOptions示例:
{
appNodes: [() => {
const base = '/appmodule/api/appmodule';
return {
get?: base,
create?: string ;
get?: string ;
update?: string ;
};
}, {
fetchProperties: '*,parent[id,code,name]',
}],
}
调用:
data(arg: object | (() => object) = {}) { }
headers(arg: object | (() => object) = {}) { }
config(arg: object) { }
silent(arg: boolean = true) { } // 是否提示错误
params(arg: object | (() => object) = {}) { }
transformRequest(arg: AxiosTransformer[] | (() => AxiosTransformer[]) = []) {}
transformResponse(arg: AxiosTransformer[] | (() => AxiosTransformer[]) = []) {}
responseInterceptor(arg: InterceptorHandler[] | (() => InterceptorHandler[]) = []) {}
requestInterceptor(arg: InterceptorHandler[] | (() => InterceptorHandler[]) = []) {}
subscribe(sub: Function) {}
send() {} // 发送请求
go() {} // send的别名