@maioradv/cms-basic-lib 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +6 -5
- package/dist/config.d.ts +2 -2
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -28,11 +28,12 @@ class MaiorCmsApiClient {
|
|
|
28
28
|
this._initModules();
|
|
29
29
|
}
|
|
30
30
|
_initClient() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const client = axios_1.default.create();
|
|
32
|
+
client.defaults.baseURL = this.configApi.sandbox ? `http://${this.configApi.host}` : `https://${this.configApi.host}`;
|
|
33
|
+
client.defaults.headers.common[types_1.ApiHeader.ApiVersion] = this.configApi.version;
|
|
34
|
+
client.defaults.headers.common[types_1.ApiHeader.ApiCacheControl] = this.configApi.disableCache ? 'no-cache' : 'caching';
|
|
35
|
+
client.defaults.headers.common['Content-Type'] = 'application/json';
|
|
36
|
+
return this.configApi.axios ? this.configApi.axios(client) : client;
|
|
36
37
|
}
|
|
37
38
|
_initModules() {
|
|
38
39
|
this.authentication = new auth_1.default(this.client);
|
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
2
|
import { ApiVersion, WithRequired } from "./types";
|
|
3
3
|
export type ApiConfigs = {
|
|
4
4
|
host: string;
|
|
@@ -9,7 +9,7 @@ export type ApiConfigs = {
|
|
|
9
9
|
version?: ApiVersion;
|
|
10
10
|
sandbox?: boolean;
|
|
11
11
|
disableCache?: boolean;
|
|
12
|
-
axios?: (axios:
|
|
12
|
+
axios?: (axios: AxiosInstance) => AxiosInstance;
|
|
13
13
|
};
|
|
14
14
|
export type ValidatedApiConfigs = ApiConfigs & WithRequired<ApiConfigs, 'version' | 'sandbox'>;
|
|
15
15
|
export declare function validateConfigs(configs: ApiConfigs): ValidatedApiConfigs;
|