A pattern currently often used is authentication for the purpose of redirecting if unauthenticated and proceeding if authenticated is the serverside fetching on data on the user and appropriate handling of its outcomes.
This could be a function - would be nice, I think?