@vritti/quantum-ui 0.2.1 → 0.2.2
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/dist/axios.js +22 -6
- package/dist/axios.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/package.json +1 -1
package/dist/axios.js
CHANGED
|
@@ -16,17 +16,32 @@ const defaultConfig = {
|
|
|
16
16
|
auth: {
|
|
17
17
|
tokenHeaderName: "Authorization",
|
|
18
18
|
tokenPrefix: "Bearer",
|
|
19
|
-
tokenEndpoint: "/auth/token",
|
|
20
|
-
refreshEndpoint: "/auth/refresh",
|
|
19
|
+
tokenEndpoint: "cloud-api/auth/token",
|
|
20
|
+
refreshEndpoint: "cloud-api/auth/refresh",
|
|
21
21
|
sessionRecoveryEnabled: true
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
const GLOBAL_CONFIG_KEY = "__QUANTUM_UI_CONFIG__";
|
|
25
|
+
function getGlobalConfig() {
|
|
26
|
+
if (typeof window !== "undefined") {
|
|
27
|
+
const globalWindow = window;
|
|
28
|
+
if (!globalWindow[GLOBAL_CONFIG_KEY]) {
|
|
29
|
+
globalWindow[GLOBAL_CONFIG_KEY] = { ...defaultConfig };
|
|
30
|
+
}
|
|
31
|
+
return globalWindow[GLOBAL_CONFIG_KEY] ?? { ...defaultConfig };
|
|
32
|
+
}
|
|
33
|
+
return { ...defaultConfig };
|
|
34
|
+
}
|
|
35
|
+
function setGlobalConfig(config) {
|
|
36
|
+
if (typeof window !== "undefined") {
|
|
37
|
+
window[GLOBAL_CONFIG_KEY] = config;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
25
40
|
function defineConfig(config) {
|
|
26
41
|
return config;
|
|
27
42
|
}
|
|
28
43
|
function configureQuantumUI(userConfig) {
|
|
29
|
-
|
|
44
|
+
const newConfig = {
|
|
30
45
|
csrf: {
|
|
31
46
|
...defaultConfig.csrf,
|
|
32
47
|
...userConfig.csrf || {}
|
|
@@ -44,12 +59,13 @@ function configureQuantumUI(userConfig) {
|
|
|
44
59
|
...userConfig.auth || {}
|
|
45
60
|
}
|
|
46
61
|
};
|
|
62
|
+
setGlobalConfig(newConfig);
|
|
47
63
|
}
|
|
48
64
|
function getConfig() {
|
|
49
|
-
return
|
|
65
|
+
return getGlobalConfig();
|
|
50
66
|
}
|
|
51
67
|
function resetConfig() {
|
|
52
|
-
|
|
68
|
+
setGlobalConfig({ ...defaultConfig });
|
|
53
69
|
}
|
|
54
70
|
|
|
55
71
|
function bind(fn, thisArg) {
|