tradly 1.0.69 → 1.0.72
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/Roots/SetSDK.js +18 -32
- package/package.json +1 -1
package/Roots/SetSDK.js
CHANGED
|
@@ -43,39 +43,25 @@ import network, { Method } from "./../NetworkManager/NetworkManager.js";
|
|
|
43
43
|
import app from "./App.js";
|
|
44
44
|
|
|
45
45
|
class SetSDK {
|
|
46
|
-
async config(init = { domain,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
.then((response) => {
|
|
56
|
-
if (response.data.status) {
|
|
57
|
-
APPCONSTANT.TOKEN = response.data.data.key;
|
|
58
|
-
APPCONSTANT.ENVIRONMENT = env;
|
|
59
|
-
APPCONSTANT.DOMAIN = domain;
|
|
60
|
-
|
|
61
|
-
Cookies.set(
|
|
62
|
-
`pk_key`,
|
|
63
|
-
CryptoJS.AES.encrypt(
|
|
64
|
-
response.data.data.key,
|
|
65
|
-
"2ae86116e90f965c0e4d37376a0089cb76a61f99246faf2c95d13d3af7824977"
|
|
66
|
-
).toString()
|
|
67
|
-
);
|
|
68
|
-
Cookies.set(
|
|
69
|
-
`user_domain`,
|
|
70
|
-
domain.toString()
|
|
71
|
-
);
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
.catch((error) => {
|
|
76
|
-
console.log(error.response.data);
|
|
77
|
-
return error.response;
|
|
46
|
+
async config(init = { domain, env }) {
|
|
47
|
+
try {
|
|
48
|
+
const response = await axios({
|
|
49
|
+
url: `https://api.tradly.app/skua/tenants/pk_by_domain?domain=${init.domain}&env=${init.env}`,
|
|
50
|
+
method: "GET",
|
|
51
|
+
responseType: "json",
|
|
52
|
+
headers: {
|
|
53
|
+
"Content-Type": "application/json",
|
|
54
|
+
},
|
|
78
55
|
});
|
|
56
|
+
if (response.data.status) {
|
|
57
|
+
APPCONSTANT.TOKEN = response.data.data.key;
|
|
58
|
+
APPCONSTANT.ENVIRONMENT = init.env;
|
|
59
|
+
APPCONSTANT.DOMAIN = init.domain;
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
return error;
|
|
64
|
+
}
|
|
79
65
|
}
|
|
80
66
|
}
|
|
81
67
|
const set_sdk = new SetSDK();
|