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