import { useState } from 'react'; import { Link, useNavigate, useSearchParams } from 'react-router-dom'; import { login, initiateGoogleLogin } from '../services/authService'; import { useAuthStore } from '../store/useAuthStore'; import { useSEO } from '../utils/useSEO'; export const LoginPage: React.FC = () => { useSEO({ title: 'Sign In — Velxio', description: 'Sign in to your Velxio account to save projects and access your Arduino simulations.', url: 'https://velxio.dev/login', noindex: true, }); const navigate = useNavigate(); const [searchParams] = useSearchParams(); const setUser = useAuthStore((s) => s.setUser); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(''); setLoading(true); try { const user = await login(email, password); setUser(user); navigate(searchParams.get('redirect') || '/'); } catch (err: any) { setError(err?.response?.data?.detail || 'Login failed.'); } finally { setLoading(false); } }; return (
to continue to Velxio
{error &&Don't have an account? Sign up