Skip to content

Instantly share code, notes, and snippets.

@boxxa
Created May 8, 2015 15:21
Show Gist options
  • Save boxxa/33618f2afac3a167a53f to your computer and use it in GitHub Desktop.
Save boxxa/33618f2afac3a167a53f to your computer and use it in GitHub Desktop.
Iron-Router Session Variable Hook
Meteor.call('setStatus', statusMessage, function(error, result){
if(result)
{
Session.set('isAway', true)
Router.go('/')
} else {
Router.go('/error')
}
})
onBeforeAction: function () {
var self = this;
if(Meteor.userId())
{
Meteor.call('checkStatus',function(error,result){
if(result)
{
Session.set('isAway',true)
self.render('awayPage')
} else {
Session.set('isAway', false)
}
})
}
this.next()
},
action: function()
{
if(Session.set('isAway',true))
this.render('awayPage')
else
this.render('homePage')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment