@kustomer/apps-common
Advanced tools
Comparing version 0.1.45 to 0.1.46
@@ -13,3 +13,3 @@ import { AxiosInstance, AxiosRequestConfig } from 'axios'; | ||
readonly logger?: KLogger; | ||
readonly proxy?: boolean; | ||
readonly proxy?: AxiosInstance; | ||
} | ||
@@ -16,0 +16,0 @@ export declare class APIBase { |
@@ -31,6 +31,9 @@ import axios from 'axios'; | ||
new Logger(`kapp:${this.options.app}:${this.name}`); | ||
this.axios = axios.create({ | ||
baseURL: this.options.proxy ? undefined : this.baseUrls.api | ||
}); | ||
this.axios.interceptors.request.use(this._onRequest.bind(this)); | ||
if (this.options.proxy) { | ||
this.axios = this.options.proxy; | ||
} | ||
else { | ||
this.axios = axios.create({ baseURL: this.baseUrls.api }); | ||
this.axios.interceptors.request.use(this._onRequest.bind(this)); | ||
} | ||
} | ||
@@ -50,3 +53,3 @@ /** | ||
try { | ||
const res = await axios.get(`${this.options.proxy ? '' : this.baseUrls.gateway}/v1/orgs/${this.orgNameOrId}/token`, { | ||
const res = await axios.get(`${this.baseUrls.gateway}/v1/orgs/${this.orgNameOrId}/token`, { | ||
headers: { | ||
@@ -53,0 +56,0 @@ 'x-kustomer-app-client-id': this.options.clientId, |
{ | ||
"name": "@kustomer/apps-common", | ||
"version": "0.1.45", | ||
"version": "0.1.46", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
130392
1567