From 6f3b8f81a9f83fbf01bf2a963f498f5ca3090209 Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Fri, 23 Dec 2022 22:23:11 -0500 Subject: [PATCH] Adding logout and some i18n --- App.js | 1 + Views/Login.js | 3 +++ Views/Menu.js | 2 +- Views/ProfileSettings.js | 1 - components/Login.js | 17 +++++++++++++---- i18nMessages.js | 5 ++++- 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/App.js b/App.js index 1f67c37..84eb426 100644 --- a/App.js +++ b/App.js @@ -266,6 +266,7 @@ export default function App() { /> + diff --git a/Views/Login.js b/Views/Login.js index debc86e..e0160a3 100644 --- a/Views/Login.js +++ b/Views/Login.js @@ -23,6 +23,9 @@ export default function App({navigation, route}) { + + {"<- Not an EMI family memeber?"} + ); } diff --git a/Views/Menu.js b/Views/Menu.js index 14f9023..cb5f107 100644 --- a/Views/Menu.js +++ b/Views/Menu.js @@ -25,7 +25,7 @@ let MenuView = ({navigation})=>{ {navigation.navigate("ProfileSettings")}} left={props => } /> } /> - } /> + {navigation.navigate("Logout")}} left={props => } /> {navigation.navigate("Invite")}} left={props => } /> diff --git a/Views/ProfileSettings.js b/Views/ProfileSettings.js index dda283f..71b923f 100644 --- a/Views/ProfileSettings.js +++ b/Views/ProfileSettings.js @@ -9,7 +9,6 @@ Moment.locale(i18n.locale); import { useSnapshot } from 'valtio'; import GlobalState from '../contexts/GlobalState.js'; import API from "../API.js"; -import ProfileHeader from "../components/ProfileHeader.js"; import * as ImagePicker from 'expo-image-picker'; diff --git a/components/Login.js b/components/Login.js index 14bdf8c..a930b8d 100644 --- a/components/Login.js +++ b/components/Login.js @@ -1,14 +1,15 @@ import React, { useState } from 'react'; import { Text, View, StyleSheet, Image } from 'react-native'; -import { TextInput, Button } from 'react-native-paper'; +import { TextInput, Button, HelperText } from 'react-native-paper'; import API from './../API.js'; import { useNavigation } from '@react-navigation/native'; import i18n from "../i18nMessages.js"; let LoginForm = () => { - let [email, setEmail] = useState(''); - let [password, setPassword] = useState(''); + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + const [error, setError] = useState(''); const navigation = useNavigation(); const loginCall = async ()=>{ @@ -17,7 +18,9 @@ let LoginForm = () => { index: 0, routes: [{ name: 'MainNavigation' }], }); - alert(i18n.t('message.wrongInformation')) + //console.log(r) + setError(r.status); + //alert(i18n.t('message.wrongInformation')) }; return ( @@ -39,6 +42,9 @@ let LoginForm = () => { autoCorrect={false} mode="outlined" /> + {error !== '' && error !== 'incorrect password' ? + {i18n.t("message.invalidEmail")} + : <>} setPassword(text)} @@ -52,6 +58,9 @@ let LoginForm = () => { autoCorrect={false} mode="outlined" /> + {error === 'incorrect password' ? + {i18n.t("message.reviewPassword")} + : <>}