Reputation: 219
My routes file:
Router.map ->
@route 'mainPage', path: '/'
@route 'login',
path:'/admin/login'
onBeforeAction: ->
@redirect '/' if Meteor.user()
@next()
class @AdminController extends RouteController
layoutTemplate: 'AdminHead'
onBeforeAction: ->
@redirect 'login' unless Meteor.user()
@next()
Router.route 'dashboard',
controller: 'AdminController'
path: '/admin'
Router.route 'addArticle',
controller: 'AdminController'
path: '/admin/addArticle'
It's should not redirect to login page after authorization, but it's redirects. What i do wrong?
Upvotes: 0
Views: 133
Reputation: 1268
You can redirect
if Meteor.user()
or Meteor.loggingIn()
This way it wont redirect to the login page if the user is still logging in.
Upvotes: 1