open-vault/ui/app/routes/vault/cluster/policies.js
Jordan Reimer 52fe56ec87
Eslint prefer-const (#17864)
* adds prefer-const to eslint config and runs fixer

* reverts unintended change
2022-11-09 15:15:31 -08:00

24 lines
585 B
JavaScript

import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import ClusterRoute from 'vault/mixins/cluster-route';
const ALLOWED_TYPES = ['acl', 'egp', 'rgp'];
export default Route.extend(ClusterRoute, {
version: service(),
beforeModel() {
return this.version.fetchFeatures().then(() => {
return this._super(...arguments);
});
},
model(params) {
const policyType = params.type;
if (!ALLOWED_TYPES.includes(policyType)) {
return this.transitionTo(this.routeName, ALLOWED_TYPES[0]);
}
return {};
},
});