import { LstCard } from "../extendedUI/LstCard"; import { CardHeader } from "../ui/card"; import { toast } from "sonner"; import { Label } from "../ui/label"; import { Input } from "../ui/input"; import { Button } from "../ui/button"; import { useForm } from "@tanstack/react-form"; import { Separator } from "../ui/separator"; import { useNavigate } from "@tanstack/react-router"; import { useState } from "react"; import axios from "axios"; export default function RegisterForm() { const navigate = useNavigate(); const [registering, setRegistering] = useState(false); const form = useForm({ defaultValues: { username: "", password: "", email: "", }, onSubmit: async ({ value }) => { setRegistering(true); try { const res = await axios.post("/api/auth/register", value); if (res.data.success) { navigate({ to: "/login" }); form.reset(); toast.success( `${value.username} was just created please login` ); setRegistering(false); } if (!res.data.success) { toast.error(res.data.message); setRegistering(false); } } catch (error) { //console.log(error); toast.error("There was an error registering"); setRegistering(false); } }, }); return (
Login to register
Your password Should be your windows password, as this is how you will interact with alplaprod