diff --git a/src/app/auth/login.tsx b/src/app/auth/login.tsx index 4015aabd..17a9882d 100644 --- a/src/app/auth/login.tsx +++ b/src/app/auth/login.tsx @@ -1,9 +1,10 @@ -import React, { useState } from 'react'; import { Redirect, Link } from 'expo-router'; +import React, { useState } from 'react'; import { Alert, View } from 'react-native'; import { Button, Input } from 'react-native-elements'; -import { useSession } from '../../utils/AuthContext'; + import globalStyles from '../../styles/globalStyles'; +import { useSession } from '../../utils/AuthContext'; function LoginScreen() { const sessionHandler = useSession(); diff --git a/src/app/auth/onboarding.tsx b/src/app/auth/onboarding.tsx index 78b16b02..cb3e1f92 100644 --- a/src/app/auth/onboarding.tsx +++ b/src/app/auth/onboarding.tsx @@ -1,12 +1,13 @@ +import DateTimePicker from '@react-native-community/datetimepicker'; +import { Redirect, router } from 'expo-router'; import { useState, useEffect } from 'react'; import { View, Alert, ScrollView, Platform } from 'react-native'; import { Button, Input } from 'react-native-elements'; -import DateTimePicker from '@react-native-community/datetimepicker'; -import { Redirect, router } from 'expo-router'; -import supabase from '../../utils/supabase'; + import UserStringInput from '../../components/UserStringInput'; -import { useSession } from '../../utils/AuthContext'; import globalStyles from '../../styles/globalStyles'; +import { useSession } from '../../utils/AuthContext'; +import supabase from '../../utils/supabase'; function OnboardingScreen() { const { session, signOut } = useSession(); diff --git a/src/app/auth/signup.tsx b/src/app/auth/signup.tsx index 9116dc6e..86e69e6a 100644 --- a/src/app/auth/signup.tsx +++ b/src/app/auth/signup.tsx @@ -1,9 +1,10 @@ -import React, { useEffect, useState } from 'react'; import { Redirect, Link, router } from 'expo-router'; +import React, { useEffect, useState } from 'react'; import { Alert, View, Text } from 'react-native'; import { Button, Input } from 'react-native-elements'; -import { useSession } from '../../utils/AuthContext'; + import globalStyles from '../../styles/globalStyles'; +import { useSession } from '../../utils/AuthContext'; function SignUpScreen() { const { session, signUp } = useSession(); diff --git a/src/app/auth/verify.tsx b/src/app/auth/verify.tsx index b6563d17..75ea84b7 100644 --- a/src/app/auth/verify.tsx +++ b/src/app/auth/verify.tsx @@ -1,20 +1,23 @@ +import { router } from 'expo-router'; import React, { useState } from 'react'; import { Alert, TextInput, View, StyleSheet } from 'react-native'; import { Button } from 'react-native-elements'; -import { useSession } from '../../utils/AuthContext'; + import globalStyles from '../../styles/globalStyles'; -import { router } from 'expo-router'; +import { useSession } from '../../utils/AuthContext'; const styles = StyleSheet.create({ input: { height: 40, borderColor: 'gray', borderWidth: 1, + marginTop: 10, + padding: 5, }, }); function VerificationScreen() { - const { user, verifyEmail } = useSession(); + const { user, verifyEmail, resendVerification } = useSession(); const [loading, setLoading] = useState(false); const [verificationCode, setCode] = useState(''); @@ -28,6 +31,10 @@ function VerificationScreen() { console.log(data); if (error) Alert.alert(error.message); else router.replace('/home'); + } else if (!user?.email) { + Alert.alert(`Please sign up again.`); + } else { + Alert.alert(`Please enter a verification code`); } setLoading(false); @@ -35,7 +42,17 @@ function VerificationScreen() { const resendCode = async () => { setLoading(true); - // Alert.alert(error.message); + + if (user?.email) { + const { error, data } = await resendVerification(user.email); + + console.log(data); + if (error) Alert.alert(error.message); + else Alert.alert(`Verification email sent to ${user.email}.`); + } else { + Alert.alert(`Please sign up again.`); + } + setLoading(false); }; @@ -45,11 +62,12 @@ function VerificationScreen() { style={styles.input} keyboardType="numeric" onChangeText={setCode} + placeholder="Verification Code" value={verificationCode} maxLength={6} /> - +