@or-sdk/base
Advanced tools
Comparing version 0.9.1 to 0.10.0
@@ -66,3 +66,3 @@ "use strict"; | ||
this.status = constants_1.SdkStatus.NEW; | ||
this.serviceUrl = ''; | ||
this._serviceUrl = ''; | ||
this.token = token; | ||
@@ -104,3 +104,3 @@ this.discoveryUrl = discoveryUrl; | ||
data = (_a.sent()).data; | ||
this.serviceUrl = this.makeApiUrl(data); | ||
this._serviceUrl = this.makeApiUrl(data); | ||
if (this.requestAccountId) { | ||
@@ -123,2 +123,9 @@ this._currentAccountId = data.accountId; | ||
}; | ||
Object.defineProperty(Base.prototype, "serviceUrl", { | ||
get: function () { | ||
return this._serviceUrl; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Base.prototype.makeApiUrl = function (data) { | ||
@@ -158,3 +165,3 @@ return data.url; | ||
case 2: return [4, this.axios({ | ||
url: this.serviceUrl + "/" + (0, utils_1.normalizeRoute)(params.route), | ||
url: this._serviceUrl + "/" + (0, utils_1.normalizeRoute)(params.route), | ||
method: params.method || 'GET', | ||
@@ -161,0 +168,0 @@ data: params.data, |
@@ -21,3 +21,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
this.status = SdkStatus.NEW; | ||
this.serviceUrl = ''; | ||
this._serviceUrl = ''; | ||
this.token = token; | ||
@@ -45,3 +45,3 @@ this.discoveryUrl = discoveryUrl; | ||
}); | ||
this.serviceUrl = this.makeApiUrl(data); | ||
this._serviceUrl = this.makeApiUrl(data); | ||
if (this.requestAccountId) { | ||
@@ -61,2 +61,5 @@ this._currentAccountId = data.accountId; | ||
} | ||
get serviceUrl() { | ||
return this._serviceUrl; | ||
} | ||
makeApiUrl(data) { | ||
@@ -89,3 +92,3 @@ return data.url; | ||
const { data } = yield this.axios({ | ||
url: `${this.serviceUrl}/${normalizeRoute(params.route)}`, | ||
url: `${this._serviceUrl}/${normalizeRoute(params.route)}`, | ||
method: params.method || 'GET', | ||
@@ -92,0 +95,0 @@ data: params.data, |
@@ -15,3 +15,3 @@ import { AxiosRequestHeaders } from 'axios'; | ||
private status; | ||
private serviceUrl; | ||
private _serviceUrl; | ||
protected constructor({ token, discoveryUrl, serviceKey, requestAccountId, requestProvidersAccountId, feature }: BaseConfig); | ||
@@ -21,2 +21,3 @@ get currentAccountId(): string | null; | ||
init(): Promise<void>; | ||
get serviceUrl(): string; | ||
makeApiUrl(data: ServiceDiscoveryResponse): string; | ||
@@ -23,0 +24,0 @@ parseError<T>(e: any): T; |
{ | ||
"version": "0.9.1", | ||
"version": "0.10.0", | ||
"name": "@or-sdk/base", | ||
@@ -31,3 +31,3 @@ "main": "dist/cjs/index.js", | ||
}, | ||
"gitHead": "19c2221d6f95694979b32f51d729771a558ef189" | ||
"gitHead": "23aeec7f6d64271cf5e44480379e40b87eb9115d" | ||
} |
@@ -19,3 +19,3 @@ import axios, { AxiosInstance, AxiosRequestHeaders } from 'axios'; | ||
private status: SdkStatus = SdkStatus.NEW; | ||
private serviceUrl = ''; | ||
private _serviceUrl = ''; | ||
@@ -59,3 +59,3 @@ protected constructor({ token, discoveryUrl, serviceKey, requestAccountId, requestProvidersAccountId, feature }: BaseConfig) { | ||
this.serviceUrl = this.makeApiUrl(data); | ||
this._serviceUrl = this.makeApiUrl(data); | ||
@@ -75,2 +75,6 @@ if (this.requestAccountId) { | ||
public get serviceUrl(): string { | ||
return this._serviceUrl; | ||
} | ||
/** | ||
@@ -127,3 +131,3 @@ * | ||
const { data } = await this.axios({ | ||
url: `${this.serviceUrl}/${normalizeRoute(params.route)}`, | ||
url: `${this._serviceUrl}/${normalizeRoute(params.route)}`, | ||
method: params.method || 'GET', | ||
@@ -130,0 +134,0 @@ data: params.data, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
46536
852