mirror of
https://github.com/hashicorp/vault.git
synced 2025-11-25 04:31:12 +01:00
29 lines
861 B
JavaScript
29 lines
861 B
JavaScript
import Route from '@ember/routing/route';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
export default class PkiCertificatesIndexRoute extends Route {
|
|
@service store;
|
|
@service secretMountPath;
|
|
@service pathHelp;
|
|
|
|
beforeModel() {
|
|
// Must call this promise before the model hook otherwise it doesn't add OpenApi to record.
|
|
return this.pathHelp.getNewModel('pki/pki-certificate-engine', 'pki');
|
|
}
|
|
|
|
model() {
|
|
return this.store
|
|
.query('pki/pki-certificate-engine', { backend: this.secretMountPath.currentPath })
|
|
.then((certificateModel) => {
|
|
return { certificateModel, parentModel: this.modelFor('certificates') };
|
|
})
|
|
.catch((err) => {
|
|
if (err.httpStatus === 404) {
|
|
return { parentModel: this.modelFor('certificates') };
|
|
} else {
|
|
throw err;
|
|
}
|
|
});
|
|
}
|
|
}
|