From b7e7871675001b258778f748e5110a5a02bfe751 Mon Sep 17 00:00:00 2001 From: Prudent Bird Date: Mon, 29 Jul 2024 15:23:03 +0100 Subject: [PATCH] Revert "chore: social auth for registration - team kimiko" --- src/app/(auth-routes)/register/page.tsx | 137 +++++------------------- src/utils/getApiUrl.ts | 11 -- 2 files changed, 28 insertions(+), 120 deletions(-) delete mode 100644 src/utils/getApiUrl.ts diff --git a/src/app/(auth-routes)/register/page.tsx b/src/app/(auth-routes)/register/page.tsx index 2c4d59ced..e5845f651 100644 --- a/src/app/(auth-routes)/register/page.tsx +++ b/src/app/(auth-routes)/register/page.tsx @@ -2,13 +2,14 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { DialogContent, DialogTitle } from "@radix-ui/react-dialog"; +import Image from "next/image"; import Link from "next/link"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; -import CustomButton from "~/components/common/common-button/common-button"; import { DialogDemo } from "~/components/common/Dialog"; +import { Button } from "~/components/ui/button"; import { Form, FormControl, @@ -23,8 +24,6 @@ import { InputOTPGroup, InputOTPSlot, } from "~/components/ui/input-otp"; -import { useToast } from "~/components/ui/use-toast"; -import { getApiUrl } from "~/utils/getApiUrl"; const formSchema = z.object({ fullname: z.string().min(2, { @@ -41,26 +40,6 @@ const formSchema = z.object({ type FormData = z.infer; const SignUp = () => { - const [apiUrl, setApiUrl] = useState(""); - const { toast } = useToast(); - - useEffect(() => { - const fetchApiUrl = async () => { - try { - const url = await getApiUrl(); - setApiUrl(url); - } catch { - toast({ - title: "Error", - description: "Failed to fetch API URL", - variant: "destructive", - }); - } - }; - - fetchApiUrl(); - }, [toast]); - const form = useForm({ resolver: zodResolver(formSchema), }); @@ -74,7 +53,7 @@ const SignUp = () => { })(); }; - const handleSubmit = async () => { + const handleSubmit = () => { form.handleSubmit(handleFormSubmit)(); }; @@ -87,77 +66,26 @@ const SignUp = () => {

- - - - - - - } - > - Sign up with Google - - - - - - - - - - - - } - > - Sign up with Facebook - + +
@@ -229,14 +157,9 @@ const SignUp = () => { )} /> - + { ))} - +

Would you rather use email and password? diff --git a/src/utils/getApiUrl.ts b/src/utils/getApiUrl.ts deleted file mode 100644 index 2579b1996..000000000 --- a/src/utils/getApiUrl.ts +++ /dev/null @@ -1,11 +0,0 @@ -"use server"; - -export const getApiUrl = async (): Promise => { - const apiUrl = process.env.API_URL; - - if (!apiUrl) { - throw new Error("API_URL environment variable is not defined"); - } - - return apiUrl; -};