I'm submitting a ... (check one with "x")
Current behaviour
Currently the events/view & events/list render the same view, i.e events/list. This is happening due to the using multiple dynamic routing.
this.route('events', function() {
this.route('view', { path: '/:event_id' }, function() {
...
}
this.route('list', { path: '/:event_state' });
}
Steps to reproduce
Both the routes load the same template.
@niranjan94 Please guide
Yes. This. I faced a similar problem in another project. lemme first see if that fix could work here too.
@geekyd works beautifully :)
beforeModel(transition) {
const eventState = transition.params[transition.targetName].event_state;
if (!['live', 'draft', 'past'].includes(eventState)) {
this.replaceWith('events.view', eventState);
}
},
In routes/events/list.js solves it.
But for this to work, this.route('list', { path: '/:event_state' }); should be after the events.view definition in router.js. That's how ember router resolves routes.
Okay I will test this locally & send a PR for this. Thanks :)