@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/helpers/api.js +31 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.26.3",
3
+ "version": "2.26.5",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -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
- 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
- }
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 = getVersion();
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
- const nuxtConfig = getNuxtRuntimeConfig();
109
- const url =
110
- nuxtConfig?.public?.API_VERITREE_URL ||
111
- process?.env?.API_VERITREE_URL ||
112
- null;
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 = url + "/api";
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;