52fe56ec87
* adds prefer-const to eslint config and runs fixer * reverts unintended change
23 lines
657 B
JavaScript
23 lines
657 B
JavaScript
import Route from '@ember/routing/route';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
export default Route.extend({
|
|
store: service(),
|
|
secretMountPath: service(),
|
|
pathHelp: service(),
|
|
beforeModel() {
|
|
return this.pathHelp.getNewModel('kmip/config', this.secretMountPath.currentPath);
|
|
},
|
|
model() {
|
|
return this.store.findRecord('kmip/config', this.secretMountPath.currentPath).catch((err) => {
|
|
if (err.httpStatus === 404) {
|
|
const model = this.store.createRecord('kmip/config');
|
|
model.set('id', this.secretMountPath.currentPath);
|
|
return model;
|
|
} else {
|
|
throw err;
|
|
}
|
|
});
|
|
},
|
|
});
|