Right now I have a second step for new users signing up. This entails users providing a bit more information about themselves after the sign up with email and password. The fields are: Username, display name and a short bio. All these fields are required and I’ve bundled them into a router I call /welcome. To keep control of whether users have successfully completed this step or not I’ve just added a field to the DB / Schema called completedOnboarding: true | false
. But after trying to optimize some of the routes and subscriptions I realised this isn’t really a great way to go about doing this. Because what I’m basically doing is publishing and subscribing globally (with the exception of the actual /welcome route) to additional user fields (as this shouldn’t be apart of profile, given the fact that it shouldn’t be possible for users to change this themselves), which isn’t that optimal. Any suggestions to how I can do this better? I was thinking of just using Session variables, but haven’t really given it a go beyond just tagging new users as Sessions.set(‘completedOnboarding’, false).
What I’m doing now is - publishing this:
Meteor.publish('userData', function(userId) {
return Meteor.users.find(userId, {
fields: {
'completedOnboarding': 1
}
});
});
And then subscribing globally like this:
Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading',
waitOn: function() {
return Meteor.subscribe('userData', Meteor.userId());
}
});