mg-library 1.0.326 → 1.0.328
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/blocks.js +1 -1
- package/login.js +38 -0
- package/mg-library.rar +0 -0
- package/package.json +1 -1
package/blocks.js
CHANGED
@@ -337,7 +337,7 @@ export function MGSessionHeader(props) {
|
|
337
337
|
<Text category='h5' style={{ color: props.theme['color-primary-500'], marginLeft: 5 }}>{props.module}</Text>
|
338
338
|
</View>
|
339
339
|
<View style={{ flexGrow: 0.35, flexDirection: 'column', justifyContent: 'center' }}>
|
340
|
-
<Text style={{ alignSelf: 'flex-end', marginBottom: -5 }} category='
|
340
|
+
<Text style={{ alignSelf: 'flex-end', marginBottom: -5 }} category='h6'>{props.person.lastName}</Text>
|
341
341
|
<Text style={{ alignSelf: 'flex-end' }}>{props.person.firstName}</Text>
|
342
342
|
</View>
|
343
343
|
<View style={{ flexGrow: 0.15, flexDirection: 'column' }}>
|
package/login.js
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
import * as mgFunctionsLib from './functions.js';
|
2
|
+
import * as mgConstantsLib from './constants.js';
|
3
|
+
import axios from 'axios';
|
4
|
+
|
5
|
+
function onPressLogin(dispatch, actions, server, 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(mgFunctionsLib.ACCESS_TOKEN, appSession.accessToken);
|
20
|
+
dispatch(actions.apiSuccess());
|
21
|
+
})
|
22
|
+
.catch(error => {
|
23
|
+
dispatch(actions.apiError());
|
24
|
+
mgFunctionsLib.showToastError(functionsLib.i18nMessage('credentialsInvalid', language));
|
25
|
+
})
|
26
|
+
}
|
27
|
+
} catch (error) {
|
28
|
+
mgFunctionsLib.showToastError(error);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
function validateForm(data, language) {
|
33
|
+
if (mgFunctionsLib.isEmpty(data.userName))
|
34
|
+
throw mgFunctionsLib.i18nMessage('userRequired', language);
|
35
|
+
if (mgFunctionsLib.isEmpty(data.password))
|
36
|
+
throw mgFunctionsLib.i18nMessage('passwordRequired', language);
|
37
|
+
return true;
|
38
|
+
}
|
package/mg-library.rar
ADDED
Binary file
|