@opencitylabs/formio-sdk 1.1.6 → 1.2.1

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.
Files changed (2) hide show
  1. package/index.js +16 -3
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -2,6 +2,7 @@ import axios from "axios";
2
2
  import get from "lodash.get";
3
3
  import { baseUrl } from "./BaseUrl.js";
4
4
  import { jwtDecode } from "jwt-decode";
5
+ import Swal from "sweetalert2";
5
6
 
6
7
  class FormIoHelper {
7
8
 
@@ -78,7 +79,8 @@ class FormIoHelper {
78
79
  const response = await axios.get(this.basePath + '/api/' + endPoint, {
79
80
  headers: {
80
81
  "Content-Type": "application/json",
81
- "Authorization": "Bearer " + token
82
+ "Authorization": "Bearer " + token,
83
+ "x-locale": this.getCurrentLocale()
82
84
  }
83
85
  })
84
86
  return response.data
@@ -91,7 +93,8 @@ class FormIoHelper {
91
93
  const response = await axios.post(this.basePath + '/api/' + endPoint, JSON.stringify(params),{
92
94
  headers: {
93
95
  "Content-Type": "application/json",
94
- "Authorization": "Bearer " + token
96
+ "Authorization": "Bearer " + token,
97
+ "x-locale": this.getCurrentLocale()
95
98
  }
96
99
  })
97
100
  return response.data
@@ -114,6 +117,7 @@ class FormIoHelper {
114
117
  headers: {
115
118
  "Content-Type": "application/json",
116
119
  Authorization: `Bearer ${token}`,
120
+ "x-locale": this.getCurrentLocale()
117
121
  },
118
122
  });
119
123
 
@@ -160,7 +164,8 @@ class FormIoHelper {
160
164
  async anonymousCall(endPoint) {
161
165
  const response = await axios.get(this.basePath + '/api/' + endPoint, {
162
166
  headers: {
163
- "Content-Type": "application/json"
167
+ "Content-Type": "application/json",
168
+ "x-locale": this.getCurrentLocale()
164
169
  }
165
170
  })
166
171
  return response.data
@@ -533,6 +538,14 @@ class FormIoHelper {
533
538
  }
534
539
  }
535
540
 
541
+ showAlert(config = {}) {
542
+ const defaults = {
543
+ icon: "info",
544
+ confirmButtonText: "OK",
545
+ };
546
+ return Swal.fire({ ...defaults, ...config });
547
+ }
548
+
536
549
  isUser() {
537
550
  try {
538
551
  const rawSessionToken = window.sessionStorage.getItem('auth-token');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencitylabs/formio-sdk",
3
- "version": "1.1.6",
3
+ "version": "1.2.1",
4
4
  "description": "Node/browser SDK helper for Form.io APIs",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -24,7 +24,7 @@
24
24
  "author": "OpencityLabs",
25
25
  "license": "ISC",
26
26
  "dependencies": {
27
- "axios": "^1.13.6",
27
+ "axios": "^1.16.0",
28
28
  "jwt-decode": "^4.0.0",
29
29
  "lodash.get": "^4.4.2",
30
30
  "sweetalert2": "^11.26.24"