@giteeteam/apps-api
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -15,5 +15,11 @@ /// <reference types="node" /> | ||
* @param [AxiosConfig] config | ||
* @param [Boolean] onlyData 默认为true,只返回data数据,false时返回data, headers, status, statusText | ||
* @returns 返回的是请求后的data数据,不是axios返回的对象 | ||
*/ | ||
export declare const axios: (config: AxiosConfig, onlyData?: boolean | undefined) => Promise<any>; | ||
export declare const axios: (config: AxiosConfig) => Promise<any>; | ||
/** | ||
* 使用的是vm中注入的global axios | ||
* @param [AxiosConfig] config | ||
* @returns 返回了部分axios对象:data, headers, status, statusText | ||
*/ | ||
export declare const axiosFull: (config: AxiosConfig) => Promise<import("../global").AxiosFullResponse>; | ||
export { AxiosRequestHeaders }; | ||
@@ -20,0 +26,0 @@ export declare const requestAppsApi: ({ method, url: _url, data, headers, }: { |
/** | ||
* 使用的是vm中注入的global axios | ||
* @param [AxiosConfig] config | ||
* @param [Boolean] onlyData 默认为true,只返回data数据,false时返回data, headers, status, statusText | ||
* @returns 返回的是请求后的data数据,不是axios返回的对象 | ||
*/ | ||
export const axios = global.axios; | ||
/** | ||
* 使用的是vm中注入的global axios | ||
* @param [AxiosConfig] config | ||
* @returns 返回了部分axios对象:data, headers, status, statusText | ||
*/ | ||
export const axiosFull = global.axiosFull; | ||
// 请求应用中心的接口 | ||
@@ -8,0 +14,0 @@ export const requestAppsApi = async ({ method = 'GET', url: _url, data, headers, }) => { |
@@ -30,5 +30,13 @@ /* eslint-disable no-var */ | ||
export interface AxiosFullResponse { | ||
data: any; | ||
headers: Record<string, any>; | ||
status: number; | ||
statusText: string; | ||
} | ||
// global对象是从外层传入vm的方法 | ||
declare global { | ||
var axios: (config: AxiosConfig, onlyData?: boolean) => Promise<any>; | ||
var axios: (config: AxiosConfig) => Promise<any>; | ||
var axiosFull: (config: AxiosConfig) => Promise<AxiosFullResponse>; | ||
var applicationId: string; | ||
@@ -35,0 +43,0 @@ var appKey: string; |
{ | ||
"name": "@giteeteam/apps-api", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Giteeteam Apps API", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
26652
716