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(() => {
console.log('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?