kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 194 forks source link

[question] Global triggers except whole group #450

Closed poltorak closed 8 years ago

poltorak commented 8 years ago

Hi! I think this is not a bug but rather question. Is there any posibility to exclude whole group from global trigger? Case: Assume we got group:

group = FlowRouter.group({
  prefix: '/group',
  name: 'group
});

and some routes:

group.route({name: 'route1', {action: [some_action]})
group.route({name: 'route2', {action: [some_action]})

Now I have global trigger:

FlowRouter.triggers.enter([
  function(context) {
    return checkAuthorization(context);
  }
], {
  except: ['group'] // <- Here I want to exclude whole group
});
arunoda commented 8 years ago

This is not possible.

acomito commented 8 years ago

is there any reason this isn't possible?

can you apply triggers.enter to a group?

@poltorak @arunoda has anyone found a way to implement this?

my use case: https://forums.meteor.com/t/flow-router-question-make-an-entire-route-group-public/25887/2

Public = FlowRouter.group({
  prefix: '/Public',
  name: 'Public
});

Private = FlowRouter.group({
  prefix: '/Private',
  name: 'Private
});

Private.triggers.enter([ function(context) { return checkAuthorization(context); } ], {});