Conditional navigation on client side with Apollo + Next.js

Highlighted
Shopify Partner
16 0 8

I am working according to this Tutorial: https://developers.shopify.com/tutorials/build-a-shopify-app-with-node-and-react

and trying to implement a basic conditional routing with Apollo and Next.js.

 

The logic I am trying to achieve is -

1. Once the app starts / first page renders check if the user has already gone through the onboarding process.

2. If not - redirect him to onboarding

3. If yes - redirect him to app's main page

 

Usually, I would handle this by creating a PrivateRoute which checks that and re-routes conditionally to the onboarding process.

However, In this case, since I am using Apollo and Next.js it is not clear to me how I can achieve the same functionality.

 

Any tips would be very appreciated.

Thanks

1 Like
Highlighted
New Member
1 0 0

@uriab, any progress with this? I want to do the same but can't find the solution

0 Likes