fix
This commit is contained in:
parent
9964d26db0
commit
7a1bdd4f5b
|
|
@ -1,6 +0,0 @@
|
|||
import Login from "@/components/form/login";
|
||||
import React from "react";
|
||||
|
||||
export default function AuthPage() {
|
||||
return <>{/* <Login /> */}</>;
|
||||
}
|
||||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue