Login and logout
This commit is contained in:
@@ -2,11 +2,13 @@ import { StatusBar } from 'expo-status-bar';
|
||||
import React, { useState } from 'react';
|
||||
import { Text, View, TextInput, Button, StyleSheet } from 'react-native';
|
||||
import API from './../API.js';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
|
||||
|
||||
let LoginForm = ()=>{
|
||||
let [email, setEmail] = useState('');
|
||||
let [password, setPassword] = useState('');
|
||||
const navigation = useNavigation();
|
||||
|
||||
return (
|
||||
<View style={styles.mainView}>
|
||||
@@ -34,7 +36,7 @@ let LoginForm = ()=>{
|
||||
<Button
|
||||
onPress={async () => {
|
||||
let r = await API.logIn(email, password);
|
||||
console.log(r);
|
||||
if(r.status === "ok") navigation.navigate('Feed');
|
||||
}}
|
||||
title={"login"}
|
||||
/>
|
||||
@@ -50,7 +52,6 @@ const styles = StyleSheet.create ({
|
||||
flexDirection:'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: 'rgba(255, 0, 255, 1.0)',
|
||||
},
|
||||
input: {
|
||||
height: 40,
|
||||
|
||||
Reference in New Issue
Block a user