Blame view
client/templates/layouts/default.js
573 Bytes
d4ce6ca83
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
const handleRedirect = ( routes, redirect ) => { let currentRoute = FlowRouter.getRouteName(); if ( routes.indexOf( currentRoute ) > -1 ) { FlowRouter.go( redirect ); return true; } }; Template.default.helpers({ loggingIn() { return Meteor.loggingIn(); }, authenticated() { return !Meteor.loggingIn() && Meteor.user(); }, redirectAuthenticated() { return handleRedirect([ 'login', 'signup', 'recover-password', 'reset-password' ], '/' ); }, redirectPublic() { return handleRedirect([ 'index', 'dashboard' ], '/login' ); } }); |