Created
May 22, 2020 18:29
-
-
Save hexsprite/923465cbff898bd4a586fc4cc8c8048e to your computer and use it in GitHub Desktop.
Meteor JS: client-side version of Accounts.onLogin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// client-side version of Accounts.onLogin | |
export function onLoginUser(hook) { | |
Meteor.subscribe('allUserData', () => | |
Tracker.autorun(function (computation) { | |
// waiting for user subscription to load | |
if (!_.get(Meteor.user(), 'services.google')) { | |
return | |
} | |
// cancel autorun now that we've authenticated | |
computation.stop() | |
hook() | |
}) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment