"use client" import { useEffect } from "react"; import { useRouter } from "next/router"; const AuthRoute = ({ children }) => { const router = useRouter(); const token = req.cookies["cmc-token"]; // Access the token from cookies useEffect(() => { const isAuthenticated = token ? true : false; // if (router.pathname === "/auth/login" && isAuthenticated) { // router.push("/"); // } // if (!authenticationPages.includes(router.pathname) && !isAuthenticated) { // router.push("/auth/login"); // } }, []); return <>{children}; }; export default AuthRoute; const authenticationPages = [ // "/", "/auth", "/auth/login", "/auth/sign-up", "/auth/forgot-password", "/auth/lock-screen", "/auth/confirm-mail", "/auth/logout", ];