hamzus-ui 0.0.218 → 0.0.220

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hamzus-ui",
3
- "version": "0.0.218",
3
+ "version": "0.0.220",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -102,6 +102,8 @@
102
102
  const xhr = new XMLHttpRequest();
103
103
  xhr.open('POST', scriptPath, true);
104
104
 
105
+ xhr.withCredentials = config.requestWithCredentials || false;
106
+
105
107
  xhr.onload = function () {
106
108
  sending = false;
107
109
 
@@ -1,12 +1,15 @@
1
1
  export let config = {
2
2
  url: "http://localhost:8000",// default url for api request
3
3
  sessionTokenName: "token", // cookie name where your token is stored
4
+ requestWithCredentials: false, // whether to include credentials in the request
4
5
  }
5
6
 
6
7
  export function init(options = {
7
8
  url : "http://localhost:8000",
8
- sessionTokenName : "token"
9
+ sessionTokenName : "token",
10
+ requestWithCredentials : false
9
11
  }) {
10
12
  config.url = options.url || "http://localhost:8000";
11
13
  config.sessionTokenName = options.sessionTokenName || "token";
14
+ config.requestWithCredentials = options.requestWithCredentials || false;
12
15
  }
@@ -36,6 +36,7 @@ export function sendRequest(request) {
36
36
  var scriptPath = request.url + request.path;
37
37
  const xhr = new XMLHttpRequest();
38
38
  xhr.open('POST', scriptPath, true);
39
+ xhr.withCredentials = config.requestWithCredentials;
39
40
 
40
41
  xhr.onload = function () {
41
42