argous 1.2.208 → 1.2.210
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.d.ts +1 -3
- package/dist/api/index.js +27 -9
- package/lib/api/index.js +26 -2
- package/package.json +1 -1
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.js
CHANGED
|
@@ -54,9 +54,14 @@ 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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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;
|
|
60
65
|
};
|
|
61
66
|
exports.headers = headers;
|
|
62
67
|
/**
|
|
@@ -281,15 +286,28 @@ var agSet = function (data) { return __awaiter(void 0, void 0, void 0, function
|
|
|
281
286
|
});
|
|
282
287
|
}); };
|
|
283
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
|
+
// };
|
|
284
297
|
var action = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
285
|
-
var res;
|
|
298
|
+
var headers, res;
|
|
286
299
|
return __generator(this, function (_a) {
|
|
287
300
|
switch (_a.label) {
|
|
288
|
-
case 0:
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
headers
|
|
292
|
-
}
|
|
301
|
+
case 0:
|
|
302
|
+
headers = headers(data);
|
|
303
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
304
|
+
console.log('action headers', headers);
|
|
305
|
+
}
|
|
306
|
+
return [4 /*yield*/, fetch(exports.api() + "agaction.rslvr", {
|
|
307
|
+
method: 'POST',
|
|
308
|
+
body: JSON.stringify(data),
|
|
309
|
+
headers: headers
|
|
310
|
+
})];
|
|
293
311
|
case 1:
|
|
294
312
|
res = _a.sent();
|
|
295
313
|
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 = (
|
|
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,25 @@ 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
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
158
|
+
console.log('action headers', headers);
|
|
159
|
+
}
|
|
160
|
+
|
|
137
161
|
const res = await fetch(`${api()}agaction.rslvr`, {
|
|
138
162
|
method: 'POST',
|
|
139
163
|
body: JSON.stringify(data),
|
|
140
|
-
headers
|
|
164
|
+
headers
|
|
141
165
|
});
|
|
142
166
|
return await res.json();
|
|
143
167
|
};
|