Need some guidelines how to solve this on production.
We define Accounts.onLogin as per below, it worked normally on localhost, but when push to production, the onLogin function keep on firing every 10± seconds.
Accounts.onLogin(() => {
const redirect = Session.get('redirectAfterLogin')
if (Meteor.user()) {
const user = Meteor.user(),
settings = user.profile.settings,
language = settings.language,
country = settings.country,
currency = settings.currency,
company = settings.company
if (!Session.get('id')) { Session.set('id', user._id) }
if (!Session.get('company')) { Session.set('company', company) }
if (!Session.get('language')) { Session.set('language', language) }
if (!Session.get('country')) { Session.set('country', country) }
if (!Session.get('currency')) { Session.set('currency', currency) }
}
if (!!redirect && redirect !== '/account/sign-in') { FlowRouter.go(redirect) }
console.log('onLogin triggered')
})