argous 1.2.210 → 1.2.212
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 +7 -28
- package/dist/utils/api.d.ts +1 -1
- package/dist/utils/api.js +2 -3
- package/lib/api/index.js +2 -26
- package/lib/utils/api.ts +2 -3
- 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(): {
|
|
4
|
+
lgTkn: string;
|
|
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,15 +54,7 @@ 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
|
-
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
|
-
};
|
|
57
|
+
var headers = function () { return ({ lgTkn: utils_1.getCookie('lt') }); };
|
|
66
58
|
exports.headers = headers;
|
|
67
59
|
/**
|
|
68
60
|
* @deprecated
|
|
@@ -286,28 +278,15 @@ var agSet = function (data) { return __awaiter(void 0, void 0, void 0, function
|
|
|
286
278
|
});
|
|
287
279
|
}); };
|
|
288
280
|
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
|
-
// };
|
|
297
281
|
var action = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
298
|
-
var
|
|
282
|
+
var res;
|
|
299
283
|
return __generator(this, function (_a) {
|
|
300
284
|
switch (_a.label) {
|
|
301
|
-
case 0:
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
return [4 /*yield*/, fetch(exports.api() + "agaction.rslvr", {
|
|
307
|
-
method: 'POST',
|
|
308
|
-
body: JSON.stringify(data),
|
|
309
|
-
headers: headers
|
|
310
|
-
})];
|
|
285
|
+
case 0: return [4 /*yield*/, fetch(exports.api() + "agaction.rslvr", {
|
|
286
|
+
method: 'POST',
|
|
287
|
+
body: JSON.stringify(data),
|
|
288
|
+
headers: exports.headers()
|
|
289
|
+
})];
|
|
311
290
|
case 1:
|
|
312
291
|
res = _a.sent();
|
|
313
292
|
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
|
|
15
|
+
export declare const serverAction: (metodo: string, dados?: {}, pgCode?: string | boolean | undefined, tratarErro?: string | boolean | 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) {
|
|
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,8 +147,7 @@ var serverAction = function (metodo, dados, pgCode, tratarErro, token) {
|
|
|
147
147
|
data = {
|
|
148
148
|
pgCode: currentProgram,
|
|
149
149
|
action: metodo,
|
|
150
|
-
dados: dados
|
|
151
|
-
token: token
|
|
150
|
+
dados: dados
|
|
152
151
|
};
|
|
153
152
|
return [4 /*yield*/, api_1.action(data)];
|
|
154
153
|
case 3:
|
package/lib/api/index.js
CHANGED
|
@@ -5,17 +5,7 @@ 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
|
-
|
|
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
|
-
};
|
|
8
|
+
export const headers = () => ({ lgTkn: getCookie('lt') });
|
|
19
9
|
|
|
20
10
|
/**
|
|
21
11
|
* @deprecated
|
|
@@ -143,25 +133,11 @@ export const agSet = async (data) => {
|
|
|
143
133
|
return await res.json();
|
|
144
134
|
};
|
|
145
135
|
|
|
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
|
-
// };
|
|
154
136
|
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
|
-
|
|
161
137
|
const res = await fetch(`${api()}agaction.rslvr`, {
|
|
162
138
|
method: 'POST',
|
|
163
139
|
body: JSON.stringify(data),
|
|
164
|
-
headers
|
|
140
|
+
headers: headers()
|
|
165
141
|
});
|
|
166
142
|
return await res.json();
|
|
167
143
|
};
|
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) => {
|
|
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,8 +66,7 @@ export const serverAction = async (metodo:string, dados = {}, pgCode?:string|boo
|
|
|
66
66
|
const data = {
|
|
67
67
|
pgCode: currentProgram,
|
|
68
68
|
action: metodo,
|
|
69
|
-
dados
|
|
70
|
-
token
|
|
69
|
+
dados
|
|
71
70
|
};
|
|
72
71
|
|
|
73
72
|
const res = await action(data);
|