argous 1.2.212 → 1.2.213
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 +2 -2
- package/dist/api/index.js +25 -7
- package/dist/utils/api.d.ts +1 -1
- package/dist/utils/api.js +3 -2
- package/lib/api/index.js +23 -2
- package/lib/utils/api.ts +3 -2
- package/package.json +1 -1
package/dist/api/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function server(): string;
|
|
2
2
|
export function api(): string;
|
|
3
|
-
export function headers(): {
|
|
4
|
-
lgTkn:
|
|
3
|
+
export function headers(data: any): {
|
|
4
|
+
lgTkn: any;
|
|
5
5
|
};
|
|
6
6
|
export function fetchToArgous(request: string, data: any): any;
|
|
7
7
|
export function login(data: any): Promise<any>;
|
package/dist/api/index.js
CHANGED
|
@@ -54,7 +54,13 @@ 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
|
-
|
|
57
|
+
// export const headers = (data) => ({ lgTkn: (data?.token) ? data.token : getCookie('lt') });
|
|
58
|
+
var headers = function (data) {
|
|
59
|
+
var response = { lgTkn: (data === null || data === void 0 ? void 0 : data.token) ? data.token : utils_1.getCookie('lt') };
|
|
60
|
+
console.log('headers data', data);
|
|
61
|
+
console.log('headers', response);
|
|
62
|
+
return response;
|
|
63
|
+
};
|
|
58
64
|
exports.headers = headers;
|
|
59
65
|
/**
|
|
60
66
|
* @deprecated
|
|
@@ -278,15 +284,27 @@ var agSet = function (data) { return __awaiter(void 0, void 0, void 0, function
|
|
|
278
284
|
});
|
|
279
285
|
}); };
|
|
280
286
|
exports.agSet = agSet;
|
|
287
|
+
// export const action = async (data) => {
|
|
288
|
+
// const res = await fetch(`${api()}agaction.rslvr`, {
|
|
289
|
+
// method: 'POST',
|
|
290
|
+
// body: JSON.stringify(data),
|
|
291
|
+
// headers: headers(data)
|
|
292
|
+
// });
|
|
293
|
+
// return await res.json();
|
|
294
|
+
// };
|
|
281
295
|
var action = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
282
|
-
var res;
|
|
296
|
+
var headersResponse, res;
|
|
283
297
|
return __generator(this, function (_a) {
|
|
284
298
|
switch (_a.label) {
|
|
285
|
-
case 0:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
299
|
+
case 0:
|
|
300
|
+
headersResponse = exports.headers(data);
|
|
301
|
+
console.log('action data', data);
|
|
302
|
+
console.log('action headers', headersResponse);
|
|
303
|
+
return [4 /*yield*/, fetch(exports.api() + "agaction.rslvr", {
|
|
304
|
+
method: 'POST',
|
|
305
|
+
body: JSON.stringify(data),
|
|
306
|
+
headers: headersResponse
|
|
307
|
+
})];
|
|
290
308
|
case 1:
|
|
291
309
|
res = _a.sent();
|
|
292
310
|
return [4 /*yield*/, res.json()];
|
package/dist/utils/api.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const getServerValue: (field: string) => Promise<any>;
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const setServerValue: (field: string, value: any) => Promise<any>;
|
|
14
14
|
export declare const enableDebugger: () => void;
|
|
15
|
-
export declare const serverAction: (metodo: string, dados?: {}, pgCode?: string | boolean | undefined, tratarErro?: string | boolean | undefined) => Promise<any>;
|
|
15
|
+
export declare const serverAction: (metodo: string, dados?: {}, pgCode?: string | boolean | undefined, tratarErro?: string | boolean | undefined, token?: string | undefined) => Promise<any>;
|
|
16
16
|
export declare function setAlert(mensagem: string, type: 'error' | 'success' | 'info' | 'warning', title: string, time?: number): void;
|
|
17
17
|
export declare function setError(mensagem: string, title?: string): void;
|
|
18
18
|
export declare function setSuccess(mensagem: string, title: string, time?: number): void;
|
package/dist/utils/api.js
CHANGED
|
@@ -127,7 +127,7 @@ var enableDebugger = function () {
|
|
|
127
127
|
debuging = true;
|
|
128
128
|
};
|
|
129
129
|
exports.enableDebugger = enableDebugger;
|
|
130
|
-
var serverAction = function (metodo, dados, pgCode, tratarErro) {
|
|
130
|
+
var serverAction = function (metodo, dados, pgCode, tratarErro, token) {
|
|
131
131
|
if (dados === void 0) { dados = {}; }
|
|
132
132
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
133
133
|
var code, tErro, currentProgram, _a, data, res;
|
|
@@ -147,7 +147,8 @@ var serverAction = function (metodo, dados, pgCode, tratarErro) {
|
|
|
147
147
|
data = {
|
|
148
148
|
pgCode: currentProgram,
|
|
149
149
|
action: metodo,
|
|
150
|
-
dados: dados
|
|
150
|
+
dados: dados,
|
|
151
|
+
token: token
|
|
151
152
|
};
|
|
152
153
|
return [4 /*yield*/, api_1.action(data)];
|
|
153
154
|
case 3:
|
package/lib/api/index.js
CHANGED
|
@@ -5,7 +5,15 @@ 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 = () => ({ lgTkn: getCookie('lt') });
|
|
8
|
+
// export const headers = (data) => ({ lgTkn: (data?.token) ? data.token : getCookie('lt') });
|
|
9
|
+
export const headers = (data) => {
|
|
10
|
+
const response = { lgTkn: (data?.token) ? data.token : getCookie('lt') };
|
|
11
|
+
|
|
12
|
+
console.log('headers data', data);
|
|
13
|
+
console.log('headers', response);
|
|
14
|
+
|
|
15
|
+
return response;
|
|
16
|
+
};
|
|
9
17
|
|
|
10
18
|
/**
|
|
11
19
|
* @deprecated
|
|
@@ -133,11 +141,24 @@ export const agSet = async (data) => {
|
|
|
133
141
|
return await res.json();
|
|
134
142
|
};
|
|
135
143
|
|
|
144
|
+
// export const action = async (data) => {
|
|
145
|
+
// const res = await fetch(`${api()}agaction.rslvr`, {
|
|
146
|
+
// method: 'POST',
|
|
147
|
+
// body: JSON.stringify(data),
|
|
148
|
+
// headers: headers(data)
|
|
149
|
+
// });
|
|
150
|
+
// return await res.json();
|
|
151
|
+
// };
|
|
136
152
|
export const action = async (data) => {
|
|
153
|
+
const headersResponse = headers(data);
|
|
154
|
+
|
|
155
|
+
console.log('action data', data);
|
|
156
|
+
console.log('action headers', headersResponse);
|
|
157
|
+
|
|
137
158
|
const res = await fetch(`${api()}agaction.rslvr`, {
|
|
138
159
|
method: 'POST',
|
|
139
160
|
body: JSON.stringify(data),
|
|
140
|
-
headers:
|
|
161
|
+
headers: headersResponse
|
|
141
162
|
});
|
|
142
163
|
return await res.json();
|
|
143
164
|
};
|
package/lib/utils/api.ts
CHANGED
|
@@ -56,7 +56,7 @@ export const enableDebugger = () => {
|
|
|
56
56
|
debuging = true;
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
export const serverAction = async (metodo:string, dados = {}, pgCode?:string|boolean, tratarErro?:string|boolean) => {
|
|
59
|
+
export const serverAction = async (metodo:string, dados = {}, pgCode?:string|boolean, tratarErro?:string|boolean, token?:string) => {
|
|
60
60
|
|
|
61
61
|
const code = typeof pgCode === 'string' ? pgCode : typeof tratarErro === 'string' ? tratarErro : undefined;
|
|
62
62
|
const tErro = typeof tratarErro === 'boolean' ? tratarErro : typeof pgCode === 'boolean' ? pgCode : false;
|
|
@@ -66,7 +66,8 @@ export const serverAction = async (metodo:string, dados = {}, pgCode?:string|boo
|
|
|
66
66
|
const data = {
|
|
67
67
|
pgCode: currentProgram,
|
|
68
68
|
action: metodo,
|
|
69
|
-
dados
|
|
69
|
+
dados,
|
|
70
|
+
token
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
const res = await action(data);
|