Login and logout

This commit is contained in:
aeroreyna
2022-03-12 22:44:47 -08:00
parent 1abf26ce60
commit 082abd8fbe
7 changed files with 67 additions and 23 deletions

View File

@@ -3,35 +3,26 @@ import React, { useEffect, useState } from 'react';
import { StyleSheet, Text, View, TextInput, SafeAreaView } from 'react-native';
import API from './../API.js';
import LoginForm from './../components/Login.js';
import { Provider as PaperProvider } from 'react-native-paper';
import AwesomeIcon from 'react-native-vector-icons/FontAwesome';
export default function App({navigation, route}) {
useEffect(async () => {
let r = await API.isLoggedIn();
if(r) navigation.navigate('Feed')
if(r){
await API.logout();
navigation.navigate('Login')
}
}, []);
return (
<PaperProvider settings={{
icon: props => <AwesomeIcon {...props} />,
}}>
<SafeAreaView style={styles.container}>
<Text>EMI Social LOGO</Text>
<LoginForm />
<StatusBar style="auto" />
</SafeAreaView>
</PaperProvider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
marginTop: 25,
paddingTop: 10,
backgroundColor: "#edf2f7"
},
});