argous 1.2.211 → 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.
@@ -1,7 +1,7 @@
1
1
  export function server(): string;
2
2
  export function api(): string;
3
- export function headers(data: any): {
4
- lgTkn: any;
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
- // 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
- };
57
+ var headers = function () { return ({ lgTkn: utils_1.getCookie('lt') }); };
66
58
  exports.headers = headers;
67
59
  /**
68
60
  * @deprecated
@@ -286,27 +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 headers, res;
282
+ var res;
299
283
  return __generator(this, function (_a) {
300
284
  switch (_a.label) {
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
- })];
285
+ case 0: return [4 /*yield*/, fetch(exports.api() + "agaction.rslvr", {
286
+ method: 'POST',
287
+ body: JSON.stringify(data),
288
+ headers: exports.headers()
289
+ })];
310
290
  case 1:
311
291
  res = _a.sent();
312
292
  return [4 /*yield*/, res.json()];
@@ -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, token?: string | undefined) => Promise<any>;
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, token) {
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
- // 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
- };
8
+ export const headers = () => ({ lgTkn: getCookie('lt') });
19
9
 
20
10
  /**
21
11
  * @deprecated
@@ -143,24 +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
- console.log('action data', data);
158
- console.log('action headers', headers);
159
-
160
137
  const res = await fetch(`${api()}agaction.rslvr`, {
161
138
  method: 'POST',
162
139
  body: JSON.stringify(data),
163
- headers
140
+ headers: headers()
164
141
  });
165
142
  return await res.json();
166
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, token?:string) => {
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argous",
3
- "version": "1.2.211",
3
+ "version": "1.2.212",
4
4
  "description": "Argous.",
5
5
  "main": "lib/index.js",
6
6
  "author": "Carlos Schneider",