I am using Nextjs with axios. After login I set the auth token in http-only cookie for secure api calls. The problem is I want to check whether user is logged in by verifying whether the cookie exists. The website is designed in a way where user can land on any page(have more than 50 pages) and not necessarily homepage.
Is there a way I can check if cookie exists by creating a wrapper for whole app. I tried using getInitialProps in _app.js but no luck. Any help is appreciated.