@opencitylabs/formio-sdk 1.1.0 → 1.1.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/BaseUrl.js +17 -0
- package/index.js +5 -4
- package/package.json +3 -2
package/BaseUrl.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const baseUrl = () => {
|
|
2
|
+
const location = window.location;
|
|
3
|
+
const globalRegex = new RegExp(
|
|
4
|
+
"qa.bugliano.pi.it|localhost|opencity-labs.gitlab.io",
|
|
5
|
+
"g",
|
|
6
|
+
);
|
|
7
|
+
let url = null;
|
|
8
|
+
if (globalRegex.test(location.hostname)) {
|
|
9
|
+
url = "https://servizi.comune-qa.bugliano.pi.it/lang";
|
|
10
|
+
} else if (window.BASE_URL) {
|
|
11
|
+
url = window.BASE_URL;
|
|
12
|
+
} else {
|
|
13
|
+
const explodedPath = location.pathname.split("/");
|
|
14
|
+
url = location.origin + "/" + explodedPath[1];
|
|
15
|
+
}
|
|
16
|
+
return url;
|
|
17
|
+
};
|
package/index.js
CHANGED
|
@@ -83,7 +83,7 @@ class FormIoHelper {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
async authenticatedRequest(method, endPoint, params = {}) {
|
|
86
|
-
const token = this.getCurrentToken();
|
|
86
|
+
const token = await this.getCurrentToken();
|
|
87
87
|
if (!token) {
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
@@ -546,9 +546,10 @@ class FormIoHelper {
|
|
|
546
546
|
}
|
|
547
547
|
|
|
548
548
|
function createFormioHelper(options = {}) {
|
|
549
|
-
return new
|
|
549
|
+
return new FormIoHelper(options);
|
|
550
550
|
}
|
|
551
551
|
|
|
552
|
-
module.exports =
|
|
553
|
-
module.exports.
|
|
552
|
+
module.exports = FormIoHelper;
|
|
553
|
+
module.exports.FormIoHelper = FormIoHelper;
|
|
554
|
+
module.exports.FormioHelper = FormIoHelper;
|
|
554
555
|
module.exports.createFormioHelper = createFormioHelper;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencitylabs/formio-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Node/browser SDK helper for Form.io APIs",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"index.js",
|
|
11
|
+
"BaseUrl.js",
|
|
11
12
|
"README.md"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
@@ -25,6 +26,6 @@
|
|
|
25
26
|
"axios": "^1.13.6",
|
|
26
27
|
"jwt-decode": "^4.0.0",
|
|
27
28
|
"lodash.get": "^4.4.2",
|
|
28
|
-
"sweetalert2": "^11.26.
|
|
29
|
+
"sweetalert2": "^11.26.22"
|
|
29
30
|
}
|
|
30
31
|
}
|