added comments for proper documentation

This commit is contained in:
Ebube
2023-10-17 00:31:38 +01:00
parent 857ef15dd2
commit 97cb3b2e70
+5 -2
View File
@@ -2,16 +2,19 @@
import { useEffect } from "react";
import { useRouter } from "next/router";
/**
* This is used to protect routes in a web application.
* It checks if the user is authenticated and redirects them to the sign-in page if they are not.
*/
const AuthRoute = ({ children }) => {
const router = useRouter();
useEffect(() => {
const isAuthenticated = false;
const isAuthenticated = true; // In a real application, this would be determined based on the user's authentication status.
if (!isAuthenticated) {
router.push("/authentication/sign-in/");
}
}, [router]);
return <>{children}</>;