Adding logout and some i18n

This commit is contained in:
Adolfo Reyna
2022-12-23 22:23:11 -05:00
parent 10f70c7156
commit 6f3b8f81a9
6 changed files with 22 additions and 7 deletions

View File

@@ -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' ? <HelperText type="error" visible={true}>
{i18n.t("message.invalidEmail")}
</HelperText> : <></>}
<TextInput
style={styles.input}
onChangeText={text => setPassword(text)}
@@ -52,6 +58,9 @@ let LoginForm = () => {
autoCorrect={false}
mode="outlined"
/>
{error === 'incorrect password' ? <HelperText type="error" visible={true}>
{i18n.t("message.reviewPassword")}
</HelperText> : <></>}
<Button
style={styles.button}
onPress={async () => {