@navservice/core 1.72.0 → 1.74.0
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/build/es/index.js +16 -12
- package/build/es/utils/_api.d.ts +1 -1
- package/build/es/utils/index.d.ts +1 -1
- package/build/lib/index.cjs +29 -25
- package/build/lib/utils/_api.d.ts +1 -1
- package/build/lib/utils/index.d.ts +1 -1
- package/package.json +1 -1
package/build/es/index.js
CHANGED
|
@@ -167,18 +167,22 @@ const _api_api = class _api {
|
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
static resolve_base_url() {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
170
|
+
try {
|
|
171
|
+
if ("undefined" == typeof window) throw new Error("resolveApiBaseURL must run in browser");
|
|
172
|
+
const { hostname } = window.location;
|
|
173
|
+
const apiOverride = utils_environment.get;
|
|
174
|
+
if ("SANDBOX" === apiOverride) return "https://api-sandbox.navsoftware.com.br";
|
|
175
|
+
if ("PRODUCAO" === apiOverride) return "https://api.navsoftware.com.br";
|
|
176
|
+
if ("LOCALHOST" === apiOverride) return "http://localhost:8787";
|
|
177
|
+
if ("localhost" === hostname || hostname.startsWith("localhost")) return "http://localhost:8787";
|
|
178
|
+
const isNavSoftware = hostname.includes("navsoftware");
|
|
179
|
+
const isSandbox = hostname.includes("sandbox");
|
|
180
|
+
if (isNavSoftware && isSandbox) return "https://api-sandbox.navsoftware.com.br";
|
|
181
|
+
if (isNavSoftware) return "https://api.navsoftware.com.br";
|
|
182
|
+
} catch (error) {
|
|
183
|
+
console.log(error, 'errr 1');
|
|
184
|
+
throw new Error(`Ambiente não reconhecido: ${error}`);
|
|
185
|
+
}
|
|
182
186
|
}
|
|
183
187
|
static async post({ url, data, setToken = true }) {
|
|
184
188
|
return await this.#axios.post(url, data, _api.headers({
|
package/build/es/utils/_api.d.ts
CHANGED
package/build/lib/index.cjs
CHANGED
|
@@ -252,32 +252,36 @@ const _api_api = class _api {
|
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
static resolve_base_url() {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
255
|
+
try {
|
|
256
|
+
if (typeof window === "undefined") {
|
|
257
|
+
throw new Error("resolveApiBaseURL must run in browser");
|
|
258
|
+
}
|
|
259
|
+
const { hostname } = window.location;
|
|
260
|
+
const apiOverride = utils_environment.get;
|
|
261
|
+
if (apiOverride === "SANDBOX") {
|
|
262
|
+
return "https://api-sandbox.navsoftware.com.br";
|
|
263
|
+
}
|
|
264
|
+
if (apiOverride === "PRODUCAO") {
|
|
265
|
+
return "https://api.navsoftware.com.br";
|
|
266
|
+
}
|
|
267
|
+
if (apiOverride === "LOCALHOST") {
|
|
268
|
+
return "http://localhost:8787";
|
|
269
|
+
}
|
|
270
|
+
if (hostname === "localhost" || hostname.startsWith("localhost")) {
|
|
271
|
+
return "http://localhost:8787";
|
|
272
|
+
}
|
|
273
|
+
const isNavSoftware = hostname.includes("navsoftware");
|
|
274
|
+
const isSandbox = hostname.includes("sandbox");
|
|
275
|
+
if (isNavSoftware && isSandbox) {
|
|
276
|
+
return "https://api-sandbox.navsoftware.com.br";
|
|
277
|
+
}
|
|
278
|
+
if (isNavSoftware) {
|
|
279
|
+
return "https://api.navsoftware.com.br";
|
|
280
|
+
}
|
|
281
|
+
} catch (error) {
|
|
282
|
+
console.log(error, 'errr 1');
|
|
283
|
+
throw new Error(`Ambiente não reconhecido: ${error}`);
|
|
279
284
|
}
|
|
280
|
-
throw new Error(`Ambiente não reconhecido: ${hostname}`);
|
|
281
285
|
}
|
|
282
286
|
static async post({ url, data, setToken = true }) {
|
|
283
287
|
return await this.#axios.post(url, data, _api.headers({
|