feat: navigate to current stage of verification

This commit is contained in:
2025-06-07 01:34:13 +02:00
parent aa6de76ded
commit 357583f54d

View File

@ -3,7 +3,7 @@ import { useAuth } from "@/store/auth";
import { useVerify } from "@/store/verify";
import { Eye, MailCheck, ScanFace } from "lucide-react";
import { useEffect, type FC } from "react";
import { Outlet, useLocation } from "react-router";
import { Navigate, Outlet, useLocation } from "react-router";
const steps = [
{
@ -37,6 +37,18 @@ const VerificationLayout: FC = () => {
if (profile) loadStep(profile);
}, [loadStep, profile]);
if (step === "email" && !location.pathname.startsWith("/verify/email")) {
return <Navigate to="/verify/email" />;
}
if (step === "avatar" && !location.pathname.startsWith("/verify/avatar")) {
return <Navigate to="/verify/avatar" />;
}
if (step === "review" && !location.pathname.startsWith("/verify/review")) {
return <Navigate to="/verify/review" />;
}
return (
<div className="w-full h-screen max-h-screen overflow-y-auto flex flex-col items-center sm:justify-center bg-white/50 dark:bg-black/50">
<div className="w-full h-full sm:w-auto sm:h-auto">