Where to put Method calls when a user logs in?

As the title says, I actually tried dispatching under Accounts.onLogin() however this seems to be problem when you have Meteor.logoutOtherClients implemented inside it. For example:

Accounts.onLogin(() => {
  Meteor.logoutOtherClients((error) => {
    if (error) {
      console.log(`error: ${error.error}`)

  // Method calls

This works fine when logging in on a different browser. But this poses a problem when you open a new TAB. The console.log shows that this block of code is being called infinitely. So as a result the Method calls also gets called.

Are there other places where I can listen for user logins and dispatch my calls there?

1 Like

I think you need to move your method calls up into the body of the logoutOtherClients callback. At the moment those method calls will try to run at the same time as the logoutOtherClients is running.