PDA

View Full Version : [FIXED] Missing before configuration in route



nclemeur
17 Jul 2017, 3:53 PM
It would be good if the before property could be added when configuring a route. This should work in a similar way as the action property (ie a function is created automatically in the controller with the correct arguments, including the action argument). Obviously this can be done manually using a custom property and custom function but then why use SA...

SA 4.2 + ExtJS 6.5 classic

petr.vecera
18 Jul 2017, 2:39 AM
Hello

Thank you for the report. We are already tracking this issue. We have it marked as critical and I hope we will be able to deliver fix soon.

Regards
Petr

escorto
13 Sep 2017, 2:37 PM
I am adding my 'Before' route configuration in initConfig as a workaroud.
routes: {
'route-one': 'onRouteOne',
'route-two/:id': {
action: 'onRouteTwo',
conditions: {
':id': '([%a-zA-Z0-9-]+)'
}
}

...
/*Notice some routes like route-one with just a 'named method' in the original routes config will have to have an object assigned, for others such as route-two...the handler already has an object we just need to add the 'before' property.
*/
initConfig: function() {
let routes = this.config.routes;
routes['route-one'] = {before:"onBeforeRouteOne", action:"onRouteOne"};
routes['route-two/:id'].before = 'onBeforeRouteTwo';
this.config.routes = routes;
this.callParent();
},