Skip to content

Instantly share code, notes, and snippets.

@gabriel-dehan
Created April 21, 2012 13:13
Show Gist options
  • Save gabriel-dehan/2437032 to your computer and use it in GitHub Desktop.
Save gabriel-dehan/2437032 to your computer and use it in GitHub Desktop.
Flash messenger with meteor 0.3.3
Meteor.call('login', name, pass, function(error, user){
if ( error ) {
Session.set('message', error.error + ': ' + error.reason);
} else {
Session.set('message', 'You are now connected, ' + user.name + '.');
Session.set('user', user);
}
MyApp.navigate('/user/list');
});
MyApp = {}
MyApp.navigate = function(route) {
Router.navigate(route, {trigger: true});
// OF COURSE, this won't work because it will flush the message immediately after the redirection (Because of the automatic update in the templates)
// So I would need to set it only on the next MyApp.navigate() call
Session.set('message', undefined);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment