diff --git a/ui/app/routes/vault/cluster/tools/tool.js b/ui/app/routes/vault/cluster/tools/tool.js index 948d46bdd..1eb0a2737 100644 --- a/ui/app/routes/vault/cluster/tools/tool.js +++ b/ui/app/routes/vault/cluster/tools/tool.js @@ -7,17 +7,12 @@ import Route from '@ember/routing/route'; import { toolsActions } from 'vault/helpers/tools-actions'; export default Route.extend({ - beforeModel(transition) { - const supportedActions = toolsActions(); - const { selected_action: selectedAction } = this.paramsFor(this.routeName); - if (!selectedAction || !supportedActions.includes(selectedAction)) { - transition.abort(); - return this.transitionTo(this.routeName, supportedActions[0]); - } - }, - model(params) { - return params.selected_action; + const supportedActions = toolsActions(); + if (supportedActions.includes(params.selected_action)) { + return params.selected_action; + } + throw new Error('Given param is not a supported tool action'); }, setupController(controller, model) { diff --git a/ui/app/templates/vault/cluster/tools/error.hbs b/ui/app/templates/vault/cluster/tools/error.hbs new file mode 100644 index 000000000..95d71697f --- /dev/null +++ b/ui/app/templates/vault/cluster/tools/error.hbs @@ -0,0 +1 @@ + \ No newline at end of file