@timetac/js-client-library
Advanced tools
Comparing version 0.3.5 to 0.3.6
@@ -45,3 +45,3 @@ "use strict"; | ||
} | ||
return `${this.config.https ? 'https' : 'http'}://${(_a = this.config.host) !== null && _a !== void 0 ? _a : DEFAULT_HOST}/${this.config.account}/`; | ||
return `${(_a = axios_1.default.defaults.baseURL) !== null && _a !== void 0 ? _a : DEFAULT_HOST}/${this.config.account}/`; | ||
} | ||
@@ -48,0 +48,0 @@ setAccount(account) { |
@@ -74,2 +74,4 @@ import { AbsenceDaysEndpoint } from './absenceDays'; | ||
setAccount(account: string): void; | ||
setConfig(config: any): void; | ||
getConfig(): ApiConfig; | ||
} |
@@ -47,6 +47,5 @@ "use strict"; | ||
constructor(config) { | ||
var _a, _b, _c; | ||
this.config = config; | ||
this.config.autoRefreshToken = (_a = config.autoRefreshToken) !== null && _a !== void 0 ? _a : true; | ||
this.config.https = (_b = config.https) !== null && _b !== void 0 ? _b : true; | ||
var _a, _b; | ||
this.setConfig(Object.assign(Object.assign({}, config), { autoRefreshToken: (_a = config.autoRefreshToken) !== null && _a !== void 0 ? _a : true, https: (_b = config.https) !== null && _b !== void 0 ? _b : true })); | ||
this.config = this.getConfig(); | ||
this.state = { | ||
@@ -75,3 +74,2 @@ refreshingToken: false, | ||
axiosSetup_1.interceptor({ state: this.state, config: this.config, authentication: this.authentication }); | ||
axiosSetup_1.setAxiosDefaults({ baseURL: `${this.config.https ? 'https' : 'http'}://${(_c = this.config.host) !== null && _c !== void 0 ? _c : DEFAULT_HOST}/` }); | ||
} | ||
@@ -81,4 +79,12 @@ setAccount(account) { | ||
} | ||
setConfig(config) { | ||
var _a; | ||
this.config = Object.assign(Object.assign({}, this.config), config); | ||
axiosSetup_1.setAxiosDefaults({ baseURL: `${this.config.https ? 'https' : 'http'}://${(_a = this.config.host) !== null && _a !== void 0 ? _a : DEFAULT_HOST}` }); | ||
} | ||
getConfig() { | ||
return this.config; | ||
} | ||
} | ||
exports.default = Api; | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,2 @@ | ||
import { AxiosRequestConfig } from 'axios'; | ||
import { AuthenticationEndpoint } from '../authentication'; | ||
@@ -9,3 +10,3 @@ import { ApiConfig, ApiState } from '../baseApi'; | ||
export declare const interceptor: (apiInstanceData: interceptorParams) => void; | ||
export declare const setAxiosDefaults: (defaults: object) => void; | ||
export declare const setAxiosDefaults: (defaults: AxiosRequestConfig) => void; | ||
export {}; |
{ | ||
"name": "@timetac/js-client-library", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "TimeTac API JS client library", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/TimeTac/js-client-library#readme", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
168693
2396