mg-library 1.0.510 → 1.0.512

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.
Files changed (2) hide show
  1. package/login.js +41 -0
  2. package/package.json +1 -1
package/login.js CHANGED
@@ -2,6 +2,36 @@ import * as mgFunctionsLib from './functions.js';
2
2
  import * as mgConstantsLib from './constants.js';
3
3
  import axios from 'axios';
4
4
 
5
+ /* export function onPressLogin(dispatch, actions, app, apiUrl, language, data) {
6
+ try {
7
+ if (validateForm(data, language)) {
8
+ let requestData = {
9
+ app: app,
10
+ userName: data.userName.toLowerCase(),
11
+ password: data.password,
12
+ language: mgConstantsLib.LANGUAGE_SPANISH
13
+ }
14
+ dispatch(actions.apiRequest());
15
+ axios.post(apiUrl + '/Login', requestData, mgFunctionsLib.getRequestHeader())
16
+ .then(response => {
17
+ let appSession = response.data;
18
+ dispatch(actions.login(appSession));
19
+ mgFunctionsLib.writeToLocalStorage(mgConstantsLib.ACCESS_TOKEN, appSession.accessToken);
20
+ dispatch(actions.apiSuccess());
21
+ })
22
+ .catch(error => {
23
+ dispatch(actions.apiError());
24
+ let msg = '';
25
+ if(error.message!=undefined)
26
+ msg = ' |>| ' + error.message;
27
+ mgFunctionsLib.showToastError(mgFunctionsLib.i18nMessage('credentialsInvalid', language) + msg);
28
+ })
29
+ }
30
+ } catch (error) {
31
+ mgFunctionsLib.showToastError(error);
32
+ }
33
+ } */
34
+
5
35
  export function onPressLogin(dispatch, actions, app, apiUrl, language, data) {
6
36
  try {
7
37
  if (validateForm(data, language)) {
@@ -21,6 +51,17 @@ export function onPressLogin(dispatch, actions, app, apiUrl, language, data) {
21
51
  })
22
52
  .catch(error => {
23
53
  dispatch(actions.apiError());
54
+
55
+ console.log('ERROR');
56
+ console.log('---');
57
+ console.log(apiUrl + '/Login');
58
+ console.log('---');
59
+ console.log(requestData);
60
+ console.log('---');
61
+ console.log(mgFunctionsLib.getRequestHeader());
62
+ console.log('---');
63
+ console.log(error.response.data);
64
+
24
65
  let msg = '';
25
66
  if(error.message!=undefined)
26
67
  msg = ' |>| ' + error.message;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.510",
3
+ "version": "1.0.512",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {