diff --git a/src/app/auth/_layout.tsx b/src/app/auth/_layout.tsx index 0578a39c..cf7d8349 100644 --- a/src/app/auth/_layout.tsx +++ b/src/app/auth/_layout.tsx @@ -5,6 +5,7 @@ function StackLayout() { + ); diff --git a/src/components/Login.tsx b/src/app/auth/login.tsx similarity index 73% rename from src/components/Login.tsx rename to src/app/auth/login.tsx index 4868fe27..aa1cb78b 100644 --- a/src/components/Login.tsx +++ b/src/app/auth/login.tsx @@ -1,7 +1,9 @@ import React, { useState } from 'react'; +import { Redirect } from 'expo-router'; import { Alert, StyleSheet, View } from 'react-native'; +import { useSession } from '../../utils/AuthContext'; import { Button, Input } from 'react-native-elements'; -import { useSession } from '../utils/AuthContext'; +import { Link } from 'expo-router'; const styles = StyleSheet.create({ container: { @@ -18,8 +20,13 @@ const styles = StyleSheet.create({ }, }); -export default function Login() { +function LoginScreen() { const sessionHandler = useSession(); + + if (sessionHandler.session) { + return ; + } + const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [loading, setLoading] = useState(false); @@ -32,21 +39,6 @@ export default function Login() { setLoading(false); }; - const signUpWithEmail = async () => { - setLoading(true); - const { error } = await sessionHandler.signUp(email, password); - - if (error) { - Alert.alert(error.message); - console.error(error); - } else { - Alert.alert( - 'Please follow the directions in the confirmation email to activate your account.', - ); - } - setLoading(false); - }; - return ( @@ -70,12 +62,14 @@ export default function Login() { autoCapitalize="none" /> + + Don't have an account? Sign up +