how to create protected routes in Nextjs 14 on client side

I am creating a next app. In there, i have login, home pages at all. I created one Authentication file for protecting pages Authentication code: https://controlc.com/75886140 and i wrapped this in _app.js <Authentication> <Component {...pageProps} /> </Authentication> Its working fine. but the issue is if i type route home, i still can see home page code in source tab in chrome. I know we can use middleware to solve these kind of issue. In my case, i use only session storage so token data will be different per tab. but only cookies are supported in middleware. Any one suggest me with giving some approach to solve this issue. i dont want my home content to be loaded on DOM if the user is not logged in
75886140 - Authentication code
import Loader from "../components/LoaderComponent/Loader"; import { useRouter } from "nex - 75886140
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server