import { Icons } from "@/components/icons"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { login } from "@/lib/auth"; import { useUserStore } from "@/lib/state"; import { cn } from "@/lib/utils"; import { Link } from "@tanstack/react-router"; import { HTMLAttributes, SyntheticEvent, useState } from "react"; interface UserAuthFormProps extends HTMLAttributes {} export function RegisterForm({ className, ...props }: UserAuthFormProps) { const [isLoading, setIsLoading] = useState(false); async function onSubmit(event: SyntheticEvent) { event.preventDefault(); setIsLoading(true); // await login() setIsLoading(false); } return (
); } export function LoginForm({ className, ...props }: UserAuthFormProps) { const [isLoading, setIsLoading] = useState(false); const { setUser } = useUserStore(); async function onSubmit(event: SyntheticEvent) { event.preventDefault(); const email = (event.target as HTMLFormElement).email.value; const password = (event.target as HTMLFormElement).password.value; setIsLoading(true); const result = await login(email, password); if (result.isOk) { setUser(result.value); } else { alert("Login failed"); } setIsLoading(false); } return (

Register {" "} or{" "} Forgot Password

); }