feat: navigate to current stage of verification
This commit is contained in:
@ -3,7 +3,7 @@ import { useAuth } from "@/store/auth";
|
|||||||
import { useVerify } from "@/store/verify";
|
import { useVerify } from "@/store/verify";
|
||||||
import { Eye, MailCheck, ScanFace } from "lucide-react";
|
import { Eye, MailCheck, ScanFace } from "lucide-react";
|
||||||
import { useEffect, type FC } from "react";
|
import { useEffect, type FC } from "react";
|
||||||
import { Outlet, useLocation } from "react-router";
|
import { Navigate, Outlet, useLocation } from "react-router";
|
||||||
|
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
@ -37,6 +37,18 @@ const VerificationLayout: FC = () => {
|
|||||||
if (profile) loadStep(profile);
|
if (profile) loadStep(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 (
|
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-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">
|
<div className="w-full h-full sm:w-auto sm:h-auto">
|
||||||
|
Reference in New Issue
Block a user