Search code examples
meteoriron-router

Houston:admin Iron router onBeforeAction except


Newbie trying to use houston:admin in Meteor project with iron-router

In iron-router's hook onBeforeAction, with except: [ ... ], like

Router.onBeforeAction({ if (!Meteor.user()) { Router.go('\login'); } }, {except: ['login']});

What should I put inside except:[] to make houston:admin an exception? Or if there exists a better way.

Thanks very much for helping!


Solution

  • This isn't future proof, i.e. if any additional pages are added to the houston project this would fail on those but for just now you can use:

    {except: ['houston_home', 'houston_collection', 'houston_document', 'houston_change_password', 'houston_custom_template', 'houston_login']}

    to keep an eye on the routes you need to add and put any news ones in they would be anything in the list here (or here abouts if the file changes) https://github.com/gterrono/houston/blob/master/client/router.coffee#L100 but with houston_ at the beginning. The line you are looking for looks like this:

    BASE_HOUSTON_ROUTES = (Houston._houstonize_route(name) for name in ['home', 'collection', 'document', 'change_password', 'custom_template'])