@veritree/services 2.26.3 → 2.26.5
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/package.json +1 -1
- package/src/helpers/api.js +31 -28
package/package.json
CHANGED
package/src/helpers/api.js
CHANGED
|
@@ -11,27 +11,27 @@ import { getSession } from "./session";
|
|
|
11
11
|
*
|
|
12
12
|
* @returns {Object|null} - The runtime configuration object, or null if it's not available.
|
|
13
13
|
*/
|
|
14
|
-
function getNuxtRuntimeConfig() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function getVersion() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
14
|
+
// function getNuxtRuntimeConfig() {
|
|
15
|
+
// if (typeof useRuntimeConfig === "function") {
|
|
16
|
+
// return useRuntimeConfig();
|
|
17
|
+
// } else {
|
|
18
|
+
// return null;
|
|
19
|
+
// }
|
|
20
|
+
// }
|
|
21
|
+
|
|
22
|
+
// function getVersion() {
|
|
23
|
+
// if (process) {
|
|
24
|
+
// process?.env?.API_VERITREE_VERSION;
|
|
25
|
+
// } else {
|
|
26
|
+
// const nuxtRuntimeConfig = getNuxtRuntimeConfig();
|
|
27
|
+
|
|
28
|
+
// if (nuxtRuntimeConfig) {
|
|
29
|
+
// return nuxtRuntimeConfig.public.API_VERITREE_VERSION;
|
|
30
|
+
// }
|
|
31
|
+
// }
|
|
32
|
+
|
|
33
|
+
// return "5.0.0";
|
|
34
|
+
// }
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Adds a version parameter to a URL if it does not already have one.
|
|
@@ -53,7 +53,7 @@ function addVersionParam(url) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// Use environment variable if available, otherwise use default version
|
|
56
|
-
const version =
|
|
56
|
+
const version = process.env.API_VERITREE_VERSION || "5.0.0";
|
|
57
57
|
|
|
58
58
|
// Append version parameter to URL
|
|
59
59
|
const urlVersionParam = url.includes("?")
|
|
@@ -105,13 +105,16 @@ function getConfig(method, data, as) {
|
|
|
105
105
|
|
|
106
106
|
export default class Api {
|
|
107
107
|
constructor(resource) {
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
// Nuxt 3
|
|
109
|
+
// const nuxtConfig = getNuxtRuntimeConfig();
|
|
110
|
+
// const url =
|
|
111
|
+
// nuxtConfig?.public?.API_VERITREE_URL ||
|
|
112
|
+
// process?.env?.API_VERITREE_URL ||
|
|
113
|
+
// null;
|
|
114
|
+
|
|
115
|
+
// this.baseUrl = url + "/api";
|
|
113
116
|
|
|
114
|
-
this.baseUrl =
|
|
117
|
+
this.baseUrl = process.env ? `${process.env.API_VERITREE_URL}/api` : null;
|
|
115
118
|
this.resource = resource ? resource : "";
|
|
116
119
|
this.orgId = null;
|
|
117
120
|
this.orgType = null;
|