In this episode, we're building out a dedicated login page for our app. First, we set up a new Login
view component and register it in our router, so the app knows where to find it. Along the way, we also create a reusable PageHeading
component that takes a title as a prop, giving us consistent headings across different pages. We hook the login link in our navigation to this new login page, so users can actually get there from anywhere.
For the actual form, we move over our earlier login form and logic from the home page, tidy up the layout, and plug in those pre-made styles from the GitHub repo to make it look much nicer. We also make sure to bind our inputs for email and password, and display any errors right below them for better UX.
Next, we wire up the login form to actually log the user in, and after a successful login, we handle redirecting them straight to the dashboard page. We show how to do this programmatically with the router. For finishing touches, we do a quick clean up, remove the unnecessary code, and make sure everything works smoothly.
By the end of this episode, we've got a fully functional, good-looking login page with error handling and redirects, setting us up nicely for the rest of the authentication workflow!