open-vault/ui/app/routes/application.js

24 lines
592 B
JavaScript
Raw Normal View History

2018-04-03 14:16:57 +00:00
import Ember from 'ember';
import ControlGroupError from 'vault/lib/control-group-error';
2018-04-03 14:16:57 +00:00
const { inject } = Ember;
2018-04-03 14:16:57 +00:00
export default Ember.Route.extend({
controlGroup: inject.service(),
2018-04-03 14:16:57 +00:00
actions: {
willTransition() {
window.scrollTo(0, 0);
},
error(err, transition) {
let controlGroup = this.get('controlGroup');
if (err instanceof ControlGroupError) {
return controlGroup.handleError(err, transition);
}
if (err.path === '/v1/sys/wrapping/unwrap') {
controlGroup.unmarkTokenForUnwrap();
}
return true;
},
2018-04-03 14:16:57 +00:00
},
});