IsaiahPetrichor / ecommerce

Petrichor Coffee, E-Commerce PERN Application
2 stars 1 forks source link

Dynamic Routing #4

Closed dannysantino closed 1 year ago

dannysantino commented 1 year ago

Changes

  1. I've added a dynamic routing feature that sends a user back to the cart page, if they were previously unauthenticated and had to log in or sign up.

  2. I have also set up the navigation on the Login and Signup pages to preserve user location data throughout the authentication process.

Reasons

  1. When an unauthenticated user clicks the checkout button on the Cart page, they're first routed to the Login page. After logging in, they're redirected to the Home page and would have to go the Cart page again in order to checkout. This does not provide a very good experience which is why I have set up the navigate function on the Cart page to pass the user's current location to the Login page so they can be redirected back to the Cart page after logging in.

  2. If a previously unauthenticated user is redirected to the Login page and they don't already have an account, this change ensures the previous location data is also passed to the Signup page when they click the button to sign up.