Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

prevent going back if unable to login

ammarahm-ed6c79ef247410
diff --git a/apps/mobile/src/views/Login/index.js b/apps/mobile/src/views/Login/index.js
index fa9c18908..9239af8bd 100644
--- a/apps/mobile/src/views/Login/index.js
+++ b/apps/mobile/src/views/Login/index.js
@@ -39,7 +39,7 @@ export const Login = ({navigation}) => {
const [invalidPassword, setInvalidPassword] = useState(false);
const [username, setUsername] = useState('ammarahmed');
const [invalidUsername, setInvalidUsername] = useState(false);
- const [loginError, setLoginError] = useState(false);
+
const isFocused = useIsFocused();
useEffect(() => {
@@ -84,10 +84,12 @@ export const Login = ({navigation}) => {
await db.user.login(username, password);
} catch (e) {
console.log(e, 'ERROR');
- ToastEvent.show('Network error, failed to login', 'error');
- setLoginError(true);
- setLoggingIn(false);
+ setTimeout(() => {
+ ToastEvent.show('Network error, failed to login', 'error');
+ setLoggingIn(false);
+ }, 500);
+
return;
}
@@ -102,13 +104,12 @@ export const Login = ({navigation}) => {
navigation.goBack();
} catch (e) {
console.log(e, 'getUSer');
- setLoginError(true);
+
ToastEvent.show(`Login Failed`, 'error');
}
console.log(user);
} else {
- setLoginError(true);
ToastEvent.show('Login failed', 'error');
}
};