Vulcan/client/views/notifications/unsubscribe.js
2013-10-09 20:26:58 +09:00

19 lines
No EOL
664 B
JavaScript

Template.unsubscribe.created = function(){
var hash = this.data.hash;
Meteor.call('unsubscribeUser', hash, function(error, result){
if(result){
Session.set('unsubscribedMessage', 'You have been unsubscribed from all notifications.');
}else{
Session.set('unsubscribedMessage', 'User not found.');
}
});
trackEvent('notificationsUnsubcribe', {hash: hash});
}
Template.unsubscribe.helpers({
unsubscribed : function(){
// we have to use a session variable because the string we want to display
// depends on the return value of an asynchronous callback (unsubscribeUser)
return Session.get('unsubscribedMessage');
}
});