mg-library 1.0.369 → 1.0.371
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/login.js +1 -14
- package/package.json +1 -1
- package/reducers.js +4 -0
package/login.js
CHANGED
@@ -11,29 +11,15 @@ export function onPressLogin(dispatch, actions, server, app, apiUrl, language, d
|
|
11
11
|
password: data.password,
|
12
12
|
language: mgConstantsLib.LANGUAGE_SPANISH
|
13
13
|
}
|
14
|
-
|
15
|
-
console.log('START');
|
16
|
-
console.log(apiUrl);
|
17
|
-
console.log(requestData);
|
18
|
-
console.log('REQUEST');
|
19
|
-
|
20
14
|
dispatch(actions.apiRequest());
|
21
15
|
axios.post(apiUrl + '/Login', requestData, mgFunctionsLib.getRequestHeader())
|
22
16
|
.then(response => {
|
23
17
|
let appSession = response.data;
|
24
|
-
|
25
|
-
console.log('SUCCESS');
|
26
|
-
console.log(appSession);
|
27
|
-
|
28
18
|
dispatch(actions.login(appSession));
|
29
19
|
mgFunctionsLib.writeToLocalStorage(mgConstantsLib.ACCESS_TOKEN, appSession.accessToken);
|
30
20
|
dispatch(actions.apiSuccess());
|
31
21
|
})
|
32
22
|
.catch(error => {
|
33
|
-
|
34
|
-
console.log('ERROR');
|
35
|
-
console.log(error);
|
36
|
-
|
37
23
|
dispatch(actions.apiError());
|
38
24
|
mgFunctionsLib.showToastError(mgFunctionsLib.i18nMessage('credentialsInvalid', language));
|
39
25
|
})
|
@@ -64,6 +50,7 @@ export function onPressLogout(dispatch, actions, app, apiUrl) {
|
|
64
50
|
axios.post(apiUrl + '/Logout', requestData, mgFunctionsLib.getRequestHeader())
|
65
51
|
.then(response => {
|
66
52
|
mgFunctionsLib.writeToLocalStorage(mgConstantsLib.ACCESS_TOKEN, '');
|
53
|
+
dispatch(actions.disconnectFromServer());
|
67
54
|
dispatch(actions.apiSuccess());
|
68
55
|
})
|
69
56
|
.catch(error => {
|
package/package.json
CHANGED
package/reducers.js
CHANGED
@@ -32,6 +32,10 @@ export const mgRingBell = (state) => {
|
|
32
32
|
state.bell = !state.bell;
|
33
33
|
}
|
34
34
|
|
35
|
+
export const mgDisconnectFromServer = (state) => {
|
36
|
+
state.server = undefined;
|
37
|
+
}
|
38
|
+
|
35
39
|
export const mgLogin = (state, action) => {
|
36
40
|
state.isLoggedIn = true;
|
37
41
|
const { server, company, accessToken } = action.payload;
|