diff --git a/src/app/sign-ip.tsx b/src/app/sign-ip.tsx
deleted file mode 100644
index 7a690c5..0000000
--- a/src/app/sign-ip.tsx
+++ /dev/null
@@ -1,100 +0,0 @@
-"use client";
-
-import { authClient } from "@/utils/auth-client";
-import { useRouter } from "next/navigation";
-import { useState } from "react";
-
-export default function SignUp() {
- const [isSignUp, setIsSignUp] = useState(false);
- const [name, setName] = useState("");
- const [email, setEmail] = useState("");
- const [password, setPassword] = useState("");
- const [rememberMe, setRememberMe] = useState(false);
-
- const handleSignUp = async () => {
- const { data, error } = await authClient.signUp.email({
- name,
- email,
- password,
- callbackURL: "/",
- });
- if (error) {
- console.error(error);
- window.alert(error.message);
- }
- };
-
- const handleSignIn = async () => {
- const { data, error } = await authClient.signIn.email({
- email,
- password,
- rememberMe,
- callbackURL: "/",
- });
- if (error) {
- console.error(error);
- window.alert(error.message);
- }
- };
-
- if (isSignUp) {
- return (
-
-
Sign Up
- setName(e.target.value)}
- />
- setEmail(e.target.value)}
- />
- setPassword(e.target.value)}
- />
- setRememberMe(e.target.checked)}
- />
-
-
-
- );
- }
- return (
-
-
Sign In
- setEmail(e.target.value)}
- />
- setPassword(e.target.value)}
- />
- setRememberMe(e.target.checked)}
- />
-
-
-
- );
-}
diff --git a/src/app/sign-ip/page.tsx b/src/app/sign-ip/page.tsx
new file mode 100644
index 0000000..8c36b3c
--- /dev/null
+++ b/src/app/sign-ip/page.tsx
@@ -0,0 +1,175 @@
+"use client";
+
+import { authClient } from "@/utils/auth-client";
+import { useState } from "react";
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardFooter,
+ CardHeader,
+ CardTitle,
+} from "@/components/ui/card";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Label } from "@/components/ui/label";
+import { Checkbox } from "@/components/ui/checkbox";
+
+export default function SignUp() {
+ const [isSignUp, setIsSignUp] = useState(false);
+ const [name, setName] = useState("");
+ const [email, setEmail] = useState("");
+ const [password, setPassword] = useState("");
+ const [confirmPassword, setConfirmPassword] = useState("");
+ const [rememberMe, setRememberMe] = useState(false);
+ const [loading, setLoading] = useState(false);
+ const [error, setError] = useState(null);
+
+ const handleSignUp = async () => {
+ if (password !== confirmPassword) {
+ setError("Passwords do not match");
+ return;
+ }
+ setLoading(true);
+ setError(null);
+ const { error } = await authClient.signUp.email({
+ name,
+ email,
+ password,
+ callbackURL: "/",
+ });
+ setLoading(false);
+ if (error) {
+ setError(error.message ?? "Something went wrong");
+ }
+ };
+
+ const handleSignIn = async () => {
+ setLoading(true);
+ setError(null);
+ const { error } = await authClient.signIn.email({
+ email,
+ password,
+ rememberMe,
+ callbackURL: "/",
+ });
+ setLoading(false);
+ if (error) {
+ setError(error.message ?? "Something went wrong");
+ }
+ };
+
+ const toggle = () => {
+ setIsSignUp((v) => !v);
+ setError(null);
+ };
+
+ return (
+
+ );
+}