chec / commercejs-nextjs-demo-store

Commerce demo store built for the Jamstack. Built with Commerce.js, Next.js, and can be one-click deployed to Netlify. Includes product catalog, customer login, categories, variants, cart, checkout, payments (Stripe) order confirmation, and printable receipts.
https://commercejs-demo-store.netlify.app/
BSD 3-Clause "New" or "Revised" License
1.07k stars 206 forks source link

Centralise logic for redirecting to login when user is not logged in #158

Open robbieaverill opened 3 years ago

robbieaverill commented 3 years ago

On the account page, and the order view page, we have a verifyAuth method which runs when the component mounts. This checks that the user is logged in and redirects them away if not.

We can convert this into a HOC or something to centralise this logic.