Ghost/ghost/admin/app/mixins/404-handler.js
Kevin Ansfield ea612d7293 deps: ember-suave@2.0.1
no issue
- https://github.com/DockYard/ember-suave/releases/tag/v2.0.0
- fix linting errors arising from new rules
2016-04-08 16:27:24 +01:00

24 lines
770 B
JavaScript

import Ember from 'ember';
export default Ember.Mixin.create({
actions: {
error(error, transition) {
if (error.errors && error.errors[0].errorType === 'NotFoundError') {
transition.abort();
let routeInfo = transition.handlerInfos[transition.handlerInfos.length - 1];
let router = this.get('router');
let params = [];
for (let key of Object.keys(routeInfo.params)) {
params.push(routeInfo.params[key]);
}
return this.transitionTo('error404', router.generate(routeInfo.name, ...params).replace('/ghost/', '').replace(/^\//g, ''));
}
return this._super(...arguments);
}
}
});