feat: redirect to verify when required
This commit is contained in:
@ -31,6 +31,8 @@ const AuthLayout = () => {
|
|||||||
const authenticate = useAuth((state) => state.authenticate);
|
const authenticate = useAuth((state) => state.authenticate);
|
||||||
const hasAuthenticated = useAuth((state) => state.hasAuthenticated);
|
const hasAuthenticated = useAuth((state) => state.hasAuthenticated);
|
||||||
|
|
||||||
|
const authProfile = useAuth((s) => s.profile);
|
||||||
|
|
||||||
const signInRequired = useAuth((state) => state.signInRequired);
|
const signInRequired = useAuth((state) => state.signInRequired);
|
||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
@ -136,6 +138,14 @@ const AuthLayout = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!signInRequired &&
|
||||||
|
authProfile?.email_verified === false &&
|
||||||
|
!location.pathname.startsWith("/verify")
|
||||||
|
) {
|
||||||
|
return <Navigate to="/verify" />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BackgroundLayout>
|
<BackgroundLayout>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
|
Reference in New Issue
Block a user