After hours of research, I'm struggling to navigate the authentication routing in NextJS combined with AWS Amplify. As a newcomer to NextJS, I want to implement a feature that disables the login/register page for users who are already logged in and prevents access to the dashboard for those who aren't.
My attempted solution involved checking user authentication using the AUTH API within a middleware file, but this approach proved unsuccessful. Even extensive searching on Google yielded no relevant results or guidance on how to address this issue.
If anyone has insights or suggestions, please lend a hand.