changed route name to login
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { useEffect } from "react";
|
||||
import { useEffect, useLayoutEffect } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
/**
|
||||
@@ -10,13 +10,12 @@ import { useRouter } from "next/router";
|
||||
const AuthRoute = ({ children }) => {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
const isAuthenticated = false; // In a real application, this would be determined based on the user's authentication status.
|
||||
const isAuthenticated = false; // In a real application, this would be determined based on the user's authentication status.
|
||||
|
||||
if (!isAuthenticated) {
|
||||
router.push("/auth/sign-in");
|
||||
}
|
||||
}, [router]);
|
||||
if (!isAuthenticated) {
|
||||
router.push("/");
|
||||
return null;
|
||||
}
|
||||
|
||||
return <>{children}</>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user