argous 1.2.207 → 1.2.208

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,9 @@
1
1
  export function server(): string;
2
2
  export function api(): string;
3
- export function headers(): {
4
- lgTkn: string;
3
+ export function headers({ token }: {
4
+ token: any;
5
+ }): {
6
+ lgTkn: any;
5
7
  };
6
8
  export function fetchToArgous(request: string, data: any): any;
7
9
  export function login(data: any): Promise<any>;
package/dist/api/index.js CHANGED
@@ -54,7 +54,10 @@ 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 (_a) {
58
+ var token = _a.token;
59
+ return ({ lgTkn: (token) ? token : utils_1.getCookie('lt') });
60
+ };
58
61
  exports.headers = headers;
59
62
  /**
60
63
  * @deprecated
@@ -285,7 +288,7 @@ var action = function (data) { return __awaiter(void 0, void 0, void 0, function
285
288
  case 0: return [4 /*yield*/, fetch(exports.api() + "agaction.rslvr", {
286
289
  method: 'POST',
287
290
  body: JSON.stringify(data),
288
- headers: exports.headers()
291
+ headers: exports.headers(data)
289
292
  })];
290
293
  case 1:
291
294
  res = _a.sent();
@@ -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 = ({ token }) => ({ lgTkn: (token) ? token : getCookie('lt') });
9
9
 
10
10
  /**
11
11
  * @deprecated
@@ -137,7 +137,7 @@ export const action = async (data) => {
137
137
  const res = await fetch(`${api()}agaction.rslvr`, {
138
138
  method: 'POST',
139
139
  body: JSON.stringify(data),
140
- headers: headers()
140
+ headers: headers(data)
141
141
  });
142
142
  return await res.json();
143
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, 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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argous",
3
- "version": "1.2.207",
3
+ "version": "1.2.208",
4
4
  "description": "Argous.",
5
5
  "main": "lib/index.js",
6
6
  "author": "Carlos Schneider",