added onBeforeAction to router when required