@bexis2/bexis2-core-ui 0.4.53 → 0.4.54
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/services/Api.js +6 -1
- package/package.json +1 -1
- package/src/lib/services/Api.ts +8 -1
package/dist/services/Api.js
CHANGED
|
@@ -15,7 +15,12 @@ const apiRequest = (method, url, request) => {
|
|
|
15
15
|
const requestVerificationToken = csrfToken;
|
|
16
16
|
if (method == "post" && requestVerificationToken) {
|
|
17
17
|
// headers['__RequestVerificationToken'] = requestVerificationToken;
|
|
18
|
-
|
|
18
|
+
// Set content type to application/x-www-form-urlencoded if it's application/json
|
|
19
|
+
// because always the server expect the token in form data
|
|
20
|
+
const contentType = headers['Content-Type'];
|
|
21
|
+
if (contentType === 'application/json')
|
|
22
|
+
headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
23
|
+
// Add the token to the request body
|
|
19
24
|
request = { ...request, __RequestVerificationToken: requestVerificationToken };
|
|
20
25
|
}
|
|
21
26
|
//using the axios instance to perform the request that received from each http method
|
package/package.json
CHANGED
package/src/lib/services/Api.ts
CHANGED
|
@@ -21,7 +21,14 @@ const apiRequest = (method, url, request) => {
|
|
|
21
21
|
|
|
22
22
|
if (method == "post" && requestVerificationToken) {
|
|
23
23
|
// headers['__RequestVerificationToken'] = requestVerificationToken;
|
|
24
|
-
|
|
24
|
+
|
|
25
|
+
// Set content type to application/x-www-form-urlencoded if it's application/json
|
|
26
|
+
// because always the server expect the token in form data
|
|
27
|
+
const contentType = headers['Content-Type'];
|
|
28
|
+
if (contentType === 'application/json')
|
|
29
|
+
headers['Content-Type']='application/x-www-form-urlencoded';
|
|
30
|
+
|
|
31
|
+
// Add the token to the request body
|
|
25
32
|
request = {...request, __RequestVerificationToken: requestVerificationToken};
|
|
26
33
|
}
|
|
27
34
|
|