argous 1.2.209 → 1.2.211

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/api/index.js CHANGED
@@ -54,7 +54,15 @@ var server = function () { return "://" + config_1.getConfig()[/^[a-z]+.+\.com\.
54
54
  exports.server = server;
55
55
  var api = function () { return "" + (config_1.getConfig().ssl ? 'https' : 'http') + exports.server() + "argous/"; };
56
56
  exports.api = api;
57
- var headers = function (data) { return ({ lgTkn: (data === null || data === void 0 ? void 0 : data.token) ? data.token : utils_1.getCookie('lt') }); };
57
+ // export const headers = (data) => ({ lgTkn: (data?.token) ? data.token : getCookie('lt') });
58
+ var headers = function (data) {
59
+ var headers = { lgTkn: (data === null || data === void 0 ? void 0 : data.token) ? data.token : utils_1.getCookie('lt') };
60
+ if (process.env.NODE_ENV !== 'production') {
61
+ console.log('headers data', data);
62
+ console.log('headers', headers);
63
+ }
64
+ return headers;
65
+ };
58
66
  exports.headers = headers;
59
67
  /**
60
68
  * @deprecated
@@ -278,15 +286,27 @@ var agSet = function (data) { return __awaiter(void 0, void 0, void 0, function
278
286
  });
279
287
  }); };
280
288
  exports.agSet = agSet;
289
+ // export const action = async (data) => {
290
+ // const res = await fetch(`${api()}agaction.rslvr`, {
291
+ // method: 'POST',
292
+ // body: JSON.stringify(data),
293
+ // headers: headers(data)
294
+ // });
295
+ // return await res.json();
296
+ // };
281
297
  var action = function (data) { return __awaiter(void 0, void 0, void 0, function () {
282
- var res;
298
+ var headers, res;
283
299
  return __generator(this, function (_a) {
284
300
  switch (_a.label) {
285
- case 0: return [4 /*yield*/, fetch(exports.api() + "agaction.rslvr", {
286
- method: 'POST',
287
- body: JSON.stringify(data),
288
- headers: exports.headers(data)
289
- })];
301
+ case 0:
302
+ headers = headers(data);
303
+ console.log('action data', data);
304
+ console.log('action headers', headers);
305
+ return [4 /*yield*/, fetch(exports.api() + "agaction.rslvr", {
306
+ method: 'POST',
307
+ body: JSON.stringify(data),
308
+ headers: headers
309
+ })];
290
310
  case 1:
291
311
  res = _a.sent();
292
312
  return [4 /*yield*/, res.json()];
package/lib/api/index.js CHANGED
@@ -5,7 +5,17 @@ export const server = () => `://${getConfig()[/^[a-z]+.+\.com\.br$/.test(window.
5
5
 
6
6
  export const api = () => `${getConfig().ssl ? 'https' : 'http'}${server()}argous/`;
7
7
 
8
- export const headers = (data) => ({ lgTkn: (data?.token) ? data.token : getCookie('lt') });
8
+ // export const headers = (data) => ({ lgTkn: (data?.token) ? data.token : getCookie('lt') });
9
+ export const headers = (data) => {
10
+ const headers = { lgTkn: (data?.token) ? data.token : getCookie('lt') };
11
+
12
+ if (process.env.NODE_ENV !== 'production') {
13
+ console.log('headers data', data);
14
+ console.log('headers', headers);
15
+ }
16
+
17
+ return headers;
18
+ };
9
19
 
10
20
  /**
11
21
  * @deprecated
@@ -133,11 +143,24 @@ export const agSet = async (data) => {
133
143
  return await res.json();
134
144
  };
135
145
 
146
+ // export const action = async (data) => {
147
+ // const res = await fetch(`${api()}agaction.rslvr`, {
148
+ // method: 'POST',
149
+ // body: JSON.stringify(data),
150
+ // headers: headers(data)
151
+ // });
152
+ // return await res.json();
153
+ // };
136
154
  export const action = async (data) => {
155
+ const headers = headers(data);
156
+
157
+ console.log('action data', data);
158
+ console.log('action headers', headers);
159
+
137
160
  const res = await fetch(`${api()}agaction.rslvr`, {
138
161
  method: 'POST',
139
162
  body: JSON.stringify(data),
140
- headers: headers(data)
163
+ headers
141
164
  });
142
165
  return await res.json();
143
166
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argous",
3
- "version": "1.2.209",
3
+ "version": "1.2.211",
4
4
  "description": "Argous.",
5
5
  "main": "lib/index.js",
6
6
  "author": "Carlos Schneider",