mg-library 1.0.788 → 1.0.790
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/functions.js +8 -0
- package/login.js +4 -12
- package/package.json +1 -1
package/functions.js
CHANGED
|
@@ -100,6 +100,14 @@ export async function readFromLocalStorage(key) {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
export const removeFromLocalStorage = async (key) => {
|
|
104
|
+
try {
|
|
105
|
+
await AsyncStorage.removeItem(key);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error(error);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
103
111
|
// Strings
|
|
104
112
|
|
|
105
113
|
export function isEmpty(value) {
|
package/login.js
CHANGED
|
@@ -56,10 +56,10 @@ export function onPressLogout(dispatch, actions, app, apiUrl) {
|
|
|
56
56
|
dispatch(actions.apiRequest());
|
|
57
57
|
axios.post(apiUrl + '/Logout', requestData, mgFunctionsLib.getRequestHeader())
|
|
58
58
|
.then(response => {
|
|
59
|
-
mgFunctionsLib.
|
|
60
|
-
mgFunctionsLib.
|
|
61
|
-
mgFunctionsLib.
|
|
62
|
-
mgFunctionsLib.
|
|
59
|
+
mgFunctionsLib.removeFromLocalStorage(mgConstantsLib.ACCESS_TOKEN);
|
|
60
|
+
mgFunctionsLib.removeFromLocalStorage(mgConstantsLib.AUTH_SERVER);
|
|
61
|
+
mgFunctionsLib.removeFromLocalStorage(mgConstantsLib.AUTH_USERNAME);
|
|
62
|
+
mgFunctionsLib.removeFromLocalStorage(mgConstantsLib.AUTH_PASSWORD);
|
|
63
63
|
dispatch(actions.disconnectFromServer());
|
|
64
64
|
dispatch(actions.apiSuccess());
|
|
65
65
|
})
|
|
@@ -114,10 +114,6 @@ export function onAutoLogin(dispatch, actions, app, apiUrl, language, setAppStat
|
|
|
114
114
|
export function onAutoLoginWithAuthInfo(dispatch, actions, app, apiUrl, authInfo, language, setAppState, setNavigator) {
|
|
115
115
|
setAppState({ isLoading: true });
|
|
116
116
|
if (existsAuthInfoInStorage(authInfo)) {
|
|
117
|
-
|
|
118
|
-
console.log("con username y password");
|
|
119
|
-
console.log(apiUrl);
|
|
120
|
-
|
|
121
117
|
try {
|
|
122
118
|
let requestData = {
|
|
123
119
|
app: app,
|
|
@@ -150,10 +146,6 @@ export function onAutoLoginWithAuthInfo(dispatch, actions, app, apiUrl, authInfo
|
|
|
150
146
|
setAppState({ isLoading: false });
|
|
151
147
|
};
|
|
152
148
|
} else {
|
|
153
|
-
|
|
154
|
-
console.log("con accesstoken");
|
|
155
|
-
console.log(apiUrl);
|
|
156
|
-
|
|
157
149
|
try {
|
|
158
150
|
let requestData = {
|
|
159
151
|
app: app,
|