From b5f0423fdb06b01f39109e033025d4a0cc65f304 Mon Sep 17 00:00:00 2001 From: Ebube Date: Wed, 18 Oct 2023 00:40:45 +0100 Subject: [PATCH] edited some texts --- middlewares/AuthRoute.js | 7 ++++--- pages/_app.js | 2 +- pages/index.js | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/middlewares/AuthRoute.js b/middlewares/AuthRoute.js index 5504723..ebccbf3 100644 --- a/middlewares/AuthRoute.js +++ b/middlewares/AuthRoute.js @@ -1,10 +1,11 @@ -"use client" +"use client"; import { useEffect } from "react"; import { useRouter } from "next/router"; /** - * This is used to protect routes in a web application. + * This function 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(); @@ -14,7 +15,7 @@ const AuthRoute = ({ children }) => { if (!isAuthenticated) { router.push("/authentication/sign-in/"); - } + } }, [router]); return <>{children}; diff --git a/pages/_app.js b/pages/_app.js index 779b3c8..357fad2 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -3,7 +3,6 @@ import '../styles/remixicon.css' import 'react-tabs/style/react-tabs.css'; import "swiper/css"; import "swiper/css/bundle"; - // Chat Styles import '../styles/chat.css' // Globals Styles @@ -19,6 +18,7 @@ import { ThemeProvider, CssBaseline } from "@mui/material"; import Layout from "@/components/_App/Layout"; function MyApp({ Component, pageProps }) { + return ( <> diff --git a/pages/index.js b/pages/index.js index 2883faf..9c2b14d 100644 --- a/pages/index.js +++ b/pages/index.js @@ -15,7 +15,6 @@ import RecentOrders from "@/components/Dashboard/eCommerce/RecentOrders"; import TeamMembersList from "@/components/Dashboard/eCommerce/TeamMembersList"; import BestSellingProducts from "@/components/Dashboard/eCommerce/BestSellingProducts"; import LiveVisitsOnOurSite from "@/components/Dashboard/eCommerce/LiveVisitsOnOurSite"; -import AuthRoute from "middlewares/AuthRoute"; function MainPage() { return ( -- 2.34.1