How to setup routing for multi step process


#1

Hello, I’m pretty much a Meteor newbie, migrating from Angular/Ionic.

In my app, a registered user should be able to invite another user as friend.

If the friend is already registered, he is asked to confirm the friend request. If he is not registered, he is sent an email, inviting him to the app.

So, multiple steps and different screens shown under certain conditions:

  • No friend invited - show “Enter email to invite” screen
  • Friend invited - show “Friend request confirmation pending” screen
  • Friend request accepted - show “Friend request accepted” screen
  • Friend request rejected - show “Friend request rejected” screen, and link to “Enter email to invite” screen to invite another

Obviously, the user should not be able to navigate between those screens directly by entering specific URLs - so, I guess, all those pages should be shown under a single URL like “/friend”.

What’s the most practical way to achieve this, using Iron Router?

Thanks,
Thomas

PS: If you’re on SO, here’s the same question.


#2

There is no need for router in this case. All can and should be done on template level.

You can do such logic by using {{#if someHelper}} {{else}} {{/if}} notation in template. And in various results display different data, or different child templates.