mirror of
https://github.com/vale981/Vulcan
synced 2025-03-09 20:16:39 -04:00
19 lines
No EOL
697 B
JavaScript
19 lines
No EOL
697 B
JavaScript
Template[getTemplate('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[getTemplate('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');
|
|
}
|
|
}); |