argous 1.2.212 → 1.2.214
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 +9 -7
- package/dist/utils/api.d.ts +1 -1
- package/dist/utils/api.js +3 -2
- package/lib/api/index.js +3 -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,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
|
-
var headers = function () { return ({ lgTkn: utils_1.getCookie('lt') }); };
|
|
57
|
+
var headers = function (data) { return ({ lgTkn: (data === null || data === void 0 ? void 0 : data.token) ? data.token : utils_1.getCookie('lt') }); };
|
|
58
58
|
exports.headers = headers;
|
|
59
59
|
/**
|
|
60
60
|
* @deprecated
|
|
@@ -279,14 +279,16 @@ var agSet = function (data) { return __awaiter(void 0, void 0, void 0, function
|
|
|
279
279
|
}); };
|
|
280
280
|
exports.agSet = agSet;
|
|
281
281
|
var action = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
282
|
-
var res;
|
|
282
|
+
var actionHeaders, res;
|
|
283
283
|
return __generator(this, function (_a) {
|
|
284
284
|
switch (_a.label) {
|
|
285
|
-
case 0:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
285
|
+
case 0:
|
|
286
|
+
actionHeaders = exports.headers(data);
|
|
287
|
+
return [4 /*yield*/, fetch(exports.api() + "agaction.rslvr", {
|
|
288
|
+
method: 'POST',
|
|
289
|
+
body: JSON.stringify(data),
|
|
290
|
+
headers: actionHeaders
|
|
291
|
+
})];
|
|
290
292
|
case 1:
|
|
291
293
|
res = _a.sent();
|
|
292
294
|
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,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
|
-
export const headers = () => ({ lgTkn: getCookie('lt') });
|
|
8
|
+
export const headers = (data) => ({ lgTkn: (data?.token) ? data.token : getCookie('lt') });
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @deprecated
|
|
@@ -134,10 +134,11 @@ export const agSet = async (data) => {
|
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
export const action = async (data) => {
|
|
137
|
+
const actionHeaders = headers(data);
|
|
137
138
|
const res = await fetch(`${api()}agaction.rslvr`, {
|
|
138
139
|
method: 'POST',
|
|
139
140
|
body: JSON.stringify(data),
|
|
140
|
-
headers:
|
|
141
|
+
headers: actionHeaders
|
|
141
142
|
});
|
|
142
143
|
return await res.json();
|
|
143
144
|
};
|
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);
|