tradly 1.0.63 → 1.0.66
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/Roots.js +3 -4
- package/Roots/SetSDK.js +45 -2
- package/package.json +1 -1
package/Roots/Roots.js
CHANGED
package/Roots/SetSDK.js
CHANGED
|
@@ -4,7 +4,7 @@ import Environment from "../Helper/APIParam";
|
|
|
4
4
|
var CryptoJS = require("crypto-js");
|
|
5
5
|
import Cookies from "js-cookie";
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
/*export default set_sdk = (domain, env) => {
|
|
8
8
|
axios({
|
|
9
9
|
url: `${Environment(
|
|
10
10
|
env
|
|
@@ -36,4 +36,47 @@ export const set_sdk = (domain, env) => {
|
|
|
36
36
|
console.log(error.response.data);
|
|
37
37
|
return error.response;
|
|
38
38
|
});
|
|
39
|
-
}
|
|
39
|
+
};*/
|
|
40
|
+
|
|
41
|
+
import { EVN } from "../Helper/APIParam.js";
|
|
42
|
+
import network, { Method } from "./../NetworkManager/NetworkManager.js";
|
|
43
|
+
import app from "./App.js";
|
|
44
|
+
|
|
45
|
+
class SetSDK {
|
|
46
|
+
async config(init = { domain, environment }) {
|
|
47
|
+
axios({
|
|
48
|
+
url: `https://api.tradly.app/skua/tenants/pk_by_domain?domain=${domain}&env=${env}`,
|
|
49
|
+
method: "GET",
|
|
50
|
+
responseType: "json",
|
|
51
|
+
headers: {
|
|
52
|
+
"Content-Type": "application/json",
|
|
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;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const set_sdk = new SetSDK();
|
|
82
|
+
export default set_sdk;
|