Created
March 9, 2021 11:50
-
-
Save dr-dimitru/2143abcb3ea781c868b85b0315089b68 to your computer and use it in GitHub Desktop.
Meteor Accounts Enhancements
This file contains hidden or 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
// !!! THIS IS META CODE, NOT A REAL SUGGESTION TO A CODEBASE | |
// JUST VERY SIMPLIFIED FORM OF PROPOSAL | |
Meteor._user = new ReactiveVar(null); | |
Meteor._userId = new ReactiveVar(null); | |
Tracker.autorun(() => { | |
Meteor._user.set(Meteor.user() || null); | |
}); | |
Tracker.autorun(() => { | |
Meteor._userId.set(Meteor.userId() || null); | |
}); | |
Template.registerHelper('currentUser', () => Meteor._user.get()); | |
Meteor.user = Meteor._user.get.bind(Meteor._user); | |
Meteor.userId = Meteor._userId.get.bind(Meteor._userId); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment