This commit is contained in:
Anang Yusman 2025-09-16 22:17:46 +08:00
parent 9964d26db0
commit 7a1bdd4f5b
2 changed files with 8 additions and 10 deletions

View File

@ -1,6 +0,0 @@
import Login from "@/components/form/login";
import React from "react";
export default function AuthPage() {
return <>{/* <Login /> */}</>;
}

View File

@ -11,7 +11,13 @@ import { toast } from "sonner";
type AuthStep = "login" | "email-setup" | "otp";
const AuthPage = ({ params: { locale } }: { params: { locale: string } }) => {
type PageProps = {
params: {
locale: string;
};
};
const AuthPage = ({ params: { locale } }: PageProps) => {
const [currentStep, setCurrentStep] = useState<AuthStep>("login");
const [loginCredentials, setLoginCredentials] =
useState<LoginFormData | null>(null);
@ -20,7 +26,6 @@ const AuthPage = ({ params: { locale } }: { params: { locale: string } }) => {
const handleLoginSuccess = async (data: LoginFormData) => {
setLoginCredentials(data);
// Check email validation to determine next step
try {
const result = await validateEmail(data);
switch (result) {
@ -34,7 +39,7 @@ const AuthPage = ({ params: { locale } }: { params: { locale: string } }) => {
setCurrentStep("otp");
break;
case "success":
// The login hook will handle navigation automatically
// Already handled
break;
default:
toast.error("Unexpected response from email validation");
@ -64,7 +69,6 @@ const AuthPage = ({ params: { locale } }: { params: { locale: string } }) => {
if (loginCredentials) {
try {
await login(loginCredentials);
// Navigation handled by login
} catch (error: any) {
toast.error(error.message || "Login failed after OTP verification");
}