mirror of
https://github.com/ershisan99/todolist_next.git
synced 2026-01-28 05:12:09 +00:00
add sign-up page
This commit is contained in:
49
src/pages/sign-up.tsx
Normal file
49
src/pages/sign-up.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
import type { FormEvent } from "react";
|
||||
import React from "react";
|
||||
|
||||
import type { NextPage } from "next";
|
||||
|
||||
import { Button, Input } from "@/components";
|
||||
import { useSignUpMutation } from "@/services";
|
||||
|
||||
const Login: NextPage = () => {
|
||||
const { mutate: signUp } = useSignUpMutation();
|
||||
|
||||
const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
const formData = new FormData(e.currentTarget);
|
||||
|
||||
const values = Object.fromEntries(formData) as any;
|
||||
signUp(values);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={"flex h-screen items-center justify-center"}>
|
||||
<form
|
||||
className={"flex w-96 flex-col gap-3 rounded-md border p-6"}
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
<h1 className={"text-2xl font-bold"}>Sign up</h1>
|
||||
<label className={"flex flex-col gap-1"}>
|
||||
Username (optional)
|
||||
<Input name={"username"} type="text" />
|
||||
</label>
|
||||
<label className={"flex flex-col gap-1"}>
|
||||
Email
|
||||
<Input name={"email"} type="email" />
|
||||
</label>
|
||||
|
||||
<label className={"flex flex-col gap-1"}>
|
||||
Password
|
||||
<Input type="password" name={"password"} />
|
||||
</label>
|
||||
|
||||
<Button className={"w-full"} type={"submit"}>
|
||||
Login
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Login;
|
||||
Reference in New Issue
Block a user