ywana-core8 0.0.371 → 0.0.374

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/index.umd.js CHANGED
@@ -25,13 +25,18 @@
25
25
  return result;
26
26
  }
27
27
 
28
- var fetchAsync = function fetchAsync(method, URL, body, token) {
28
+ var fetchAsync = function fetchAsync(method, URL, body, token, headers) {
29
29
  if (body === void 0) {
30
30
  body = null;
31
31
  }
32
32
 
33
33
  try {
34
34
  console.log('FETCH', method, URL);
35
+ var requestHeaders = Object.assign({}, {
36
+ "Accept": "application/json",
37
+ "Content-Type": "application/json",
38
+ "x-access-token": token
39
+ }, headers);
35
40
  var request = {
36
41
  method: method,
37
42
  mode: 'cors',
@@ -42,6 +47,8 @@
42
47
  },
43
48
  body: body
44
49
  };
50
+ console.log("HTTP Client", request);
51
+ if (headers) request.headers = request.headers;
45
52
  return Promise.resolve(_catch$2(function () {
46
53
  return Promise.resolve(fetch(URL, request)).then(function (response) {
47
54
  var _exit;
@@ -87,9 +94,9 @@
87
94
  var token = securityCtx ? securityCtx.token() : null;
88
95
  return fetchAsync('GET', domain + URL, undefined, token);
89
96
  },
90
- POST: function POST(URL, body) {
97
+ POST: function POST(URL, body, headers) {
91
98
  var token = securityCtx ? securityCtx.token() : null;
92
- return fetchAsync('POST', domain + URL, body, token);
99
+ return fetchAsync('POST', domain + URL, body, token, headers);
93
100
  },
94
101
  PUT: function PUT(URL, body) {
95
102
  var token = securityCtx ? securityCtx.token() : null;