After spending days of research, I can't really figure out how to handle the authentication routing with NextJS and AWS Amplify. This is the first time I'm using NextJS and I want to disable the login/register page for logged in users and disable the dashboard for not logged in users.
I already tried to check if user is authenticated with the AUTH api inside a middleware file but this didn't work. Searching on Google also didn't help because I wastn't be able to find anything related to this.
Hope someone can help me out.