Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Create protected routes on the Polaris3 + Next.js tutorial

Create protected routes on the Polaris3 + Next.js tutorial

uriab
Shopify Partner
18 0 10

Issue summary

 

I am using this example from the React + Apollo + Next tutorial and I cannot figure out how to implement a behaviour which redirects the user to onboarding if he hasn't gone through onboarding yet.

https://github.com/Shopify/shopify-demo-app-node-react

 

Expected behavior

 

  1. A user opens my app on Shopify
  2. If the user has already gone through Onboarding then continue to the Dashboard.
  3. If the user hasn't gone through Onboarding, send his to the Onboarding page.
  4. This logic should run for every page in the system and it should work on server as well as on client.

 

Question

 

Any example on how to achieve the requested behaviour with the provided tutorial would be awesome.

Thanks

Reply 1 (1)

Alex
Shopify Staff
1561 81 343

This sounds like some really good feedback for the maintainers of the tutorial. I would recommend creating an issue in the repository to both ask for an example and perhaps request they work that into the example codebase. If I was proficient enough with NextJS + Node I'd offer some more assistance, so my apologies for the bare answer.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog