import React, {useState} from 'react'; import {StyleSheet, ActivityIndicator, SafeAreaView, View} from 'react-native'; import {useAuthStore} from '@/store/authStore'; import {useRouter} from 'expo-router'; import {Box} from "@/components/ui/box" import {Button, ButtonText,ButtonIcon} from "@/components/ui/button" import {ArrowRightIcon} from "@/components/ui/icon" import {Center} from "@/components/ui/center" import {Heading} from "@/components/ui/heading" import {Input, InputField} from "@/components/ui/input" import {VStack} from "@/components/ui/vstack" import {Link} from "expo-router" export default function Registration() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [firstName, setFirstName] = useState(''); const [lastName, setLastName] = useState(''); const {signUp, isLoading} = useAuthStore(); const router = useRouter(); const handleInternalRegistration = async () => { if (!email || !password || !firstName || !lastName) { alert('Proszę uzupełnić wszystkie pola'); return; } try { await signUp({email, password, firstName, lastName}); alert(`Zalogowano jako ${email}`); router.replace('/'); } catch (e) { alert("Błąd logowania: " + (e.response?.data?.message || e.message)); } } if (isLoading) { return ( ); } return (
Rejestracja {/* */} {/* */}
); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', }, formContainer: { width: '80%', }, input: { borderWidth: 1, borderColor: '#ddd', borderRadius: 5, marginBottom: 15, padding: 10, }, errorText: { color: 'red', marginBottom: 10, }, signupbutton: { fontWeight: '300', textAlign: 'left', }, });