Search code examples
meteorcollectionsiron-routermeteor-accounts

Meteor test if Users datas = "NULL"


I want to test if my currentUser have in his users collection

-> profileType: "NULL" (default value).

and if profileType != "NULL" i will redirect the user to an other template.

I don't where will be the best place to do it ?

  • In the router whith a onBeforeAction
  • on a client helper
  • call a method in the server side

Thanks in advance


Solution

  • Depends on the behavior you want.

    onBeforeAction if you put it here, your app will wait and show your loading template while it checks this.

    If you put it in a client helper you will have a noticable UI change when the data changes.

    If you make a server side method then you should also utilize onBeforeAction to wait on your call to be made.