6 |
Hi, You Are Watching Sakura Dev Channel.
7 |
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/src/app/signup/page.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 | import { Button } from "@/components/Button";
3 | import InputBox from "@/components/InputBox";
4 | import { Backend_URL } from "@/lib/Constants";
5 | import Link from "next/link";
6 | import React, { useRef } from "react";
7 |
8 | type FormInputs = {
9 | name: string;
10 | email: string;
11 | password: string;
12 | };
13 |
14 | const SignupPage = () => {
15 | const register = async () => {
16 | const res = await fetch(Backend_URL + "/auth/register", {
17 | method: "POST",
18 | body: JSON.stringify({
19 | name: data.current.name,
20 | email: data.current.email,
21 | password: data.current.password,
22 | }),
23 | headers: {
24 | "Content-Type": "application/json",
25 | },
26 | });
27 | if (!res.ok) {
28 | alert(res.statusText);
29 | return;
30 | }
31 | const response = await res.json();
32 | alert("User Registered!");
33 | console.log({ response });
34 | };
35 | const data = useRef