tradly 1.1.94 → 1.1.95
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/Constants/AppConstant.js
CHANGED
|
@@ -35,7 +35,9 @@ class NetworkManager {
|
|
|
35
35
|
"X-TRADLY-AGENT": 3,
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
if (APPCONSTANT.TOKEN && !APPCONSTANT.IS_SKIP_PK_BY_DOMAIN) {
|
|
39
|
+
header["Authorization"] = "Bearer " + APPCONSTANT.TOKEN;
|
|
40
|
+
}
|
|
39
41
|
|
|
40
42
|
if (
|
|
41
43
|
config.authKey !== null &&
|
package/Roots/InitV2.js
CHANGED
|
@@ -5,8 +5,11 @@ import { APPCONSTANT } from "../Constants/AppConstant.js";
|
|
|
5
5
|
const tenantConfigCache = new Map();
|
|
6
6
|
|
|
7
7
|
class InitV2 {
|
|
8
|
-
async config(
|
|
9
|
-
|
|
8
|
+
async config(
|
|
9
|
+
init = { domain, env, custom_header, is_skip_pk_by_domain }
|
|
10
|
+
) {
|
|
11
|
+
const { domain, env, custom_header, is_skip_pk_by_domain } =
|
|
12
|
+
init || {};
|
|
10
13
|
|
|
11
14
|
if (!domain || !env) {
|
|
12
15
|
throw new Error(
|
|
@@ -23,10 +26,34 @@ class InitV2 {
|
|
|
23
26
|
APPCONSTANT.DOMAIN_ID = cached.domain_details?.id ?? 0;
|
|
24
27
|
APPCONSTANT.ENVIRONMENT = env;
|
|
25
28
|
APPCONSTANT.DOMAIN = domain;
|
|
26
|
-
APPCONSTANT.CUSTOM_HEADER = custom_header
|
|
29
|
+
APPCONSTANT.CUSTOM_HEADER = custom_header
|
|
30
|
+
? custom_header
|
|
31
|
+
: {};
|
|
32
|
+
APPCONSTANT.IS_SKIP_PK_BY_DOMAIN =
|
|
33
|
+
is_skip_pk_by_domain ?? false;
|
|
27
34
|
return cached;
|
|
28
35
|
}
|
|
29
36
|
|
|
37
|
+
if (is_skip_pk_by_domain) {
|
|
38
|
+
APPCONSTANT.TOKEN = "";
|
|
39
|
+
APPCONSTANT.DOMAIN_ID = 0;
|
|
40
|
+
APPCONSTANT.ENVIRONMENT = env;
|
|
41
|
+
APPCONSTANT.DOMAIN = domain;
|
|
42
|
+
APPCONSTANT.CUSTOM_HEADER = custom_header
|
|
43
|
+
? custom_header
|
|
44
|
+
: {};
|
|
45
|
+
APPCONSTANT.IS_SKIP_PK_BY_DOMAIN =
|
|
46
|
+
is_skip_pk_by_domain ?? false;
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
status: true,
|
|
50
|
+
key: "",
|
|
51
|
+
domain_details: {
|
|
52
|
+
id: 0,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
30
57
|
// 2. Otherwise fetch pk_by_domain once and cache it
|
|
31
58
|
try {
|
|
32
59
|
const base =
|
|
@@ -60,7 +87,9 @@ class InitV2 {
|
|
|
60
87
|
APPCONSTANT.DOMAIN_ID = domain_details.id ?? 0;
|
|
61
88
|
APPCONSTANT.ENVIRONMENT = env;
|
|
62
89
|
APPCONSTANT.DOMAIN = domain;
|
|
63
|
-
APPCONSTANT.CUSTOM_HEADER = custom_header
|
|
90
|
+
APPCONSTANT.CUSTOM_HEADER = custom_header
|
|
91
|
+
? custom_header
|
|
92
|
+
: {};
|
|
64
93
|
|
|
65
94
|
const result = {
|
|
66
95
|
status: true,
|
|
@@ -82,4 +111,3 @@ class InitV2 {
|
|
|
82
111
|
const init_v2 = new InitV2();
|
|
83
112
|
export default init_v2;
|
|
84
113
|
|
|
85
|
-
|