Require Anonymous

πŸ‘¨β€πŸ’Ό We don't want authenticated users to get confused if they ever land on the /login or /signup pages. So let's prevent that.
I want you to make a reusable utility in that automatically redirects the user to the home page if they're already logged in.
πŸ§β€β™‚οΈ earlier you had written code in the root.tsx to get the user's ID from the session. I created a handy utility in the auth.server.ts that does that for you, so you can use that with your utility.
πŸ‘¨β€πŸ’Ό Thanks Kellie. Once you've made the utility, then I need you to create loaders in both and which use your utility to redirect the user to the home page if they're already logged in. You'll also want to include this in the actions for good measure.
πŸ¦‰ One note, we don't need any data for those routes. In that case, you do still need to return a json response, so you can do this:
export async function loader({ request }: LoaderFunctionArgs) {
	// use your utility here...
	return json({}) // <-- just return an empty object
}
🐨 So start in and then move on to the other files in the files dropdown below.