@bexis2/bexis2-core-ui 0.4.52 → 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/README.md CHANGED
@@ -1,4 +1,10 @@
1
1
  # bexis-core-ui
2
+ ## 0.4.49 -> 0.4.53
3
+ - Api
4
+ - remove __RequestVerificationToken from header
5
+ - change post request to 'application/x-www-form-urlencoded'
6
+ - add __RequestVerificationToken to data
7
+
2
8
  ## 0.4.48
3
9
  - Api
4
10
  - add __RequestVerificationToken if exist
@@ -15,7 +15,6 @@ storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
15
15
  import Docs from "./Docs.svelte";
16
16
  import GoToTop from "./GoToTop.svelte";
17
17
  import { getAntiForgeryToken } from "./PageCaller";
18
- import { isNullOrUndefined } from "util";
19
18
  export let title = "";
20
19
  export let note = "";
21
20
  export let links = [];
@@ -13,9 +13,14 @@ const apiRequest = (method, url, request) => {
13
13
  authorization: 'Basic ' + btoa(username + ':' + password)
14
14
  };
15
15
  const requestVerificationToken = csrfToken;
16
- if (method === 'post' && requestVerificationToken) {
17
- headers['__RequestVerificationToken'] = requestVerificationToken;
18
- headers['Content-Type'] = 'application/x-www-form-urlencoded';
16
+ if (method == "post" && requestVerificationToken) {
17
+ // headers['__RequestVerificationToken'] = requestVerificationToken;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bexis2/bexis2-core-ui",
3
- "version": "0.4.52",
3
+ "version": "0.4.54",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -28,7 +28,7 @@ import type { helpItemType, helpStoreType } from '$models/Models';
28
28
  import Docs from './Docs.svelte';
29
29
  import GoToTop from './GoToTop.svelte';
30
30
  import { getAntiForgeryToken } from './PageCaller';
31
- import { isNullOrUndefined } from 'util';
31
+
32
32
 
33
33
  export let title = '';
34
34
  export let note = '';
@@ -19,9 +19,16 @@ const apiRequest = (method, url, request) => {
19
19
 
20
20
  const requestVerificationToken = csrfToken;
21
21
 
22
- if (method==='post' && requestVerificationToken) {
23
- headers['__RequestVerificationToken'] = requestVerificationToken;
24
- headers['Content-Type']='application/x-www-form-urlencoded';
22
+ if (method == "post" && requestVerificationToken) {
23
+ // headers['__RequestVerificationToken'] = requestVerificationToken;
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