mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
ea612d7293
no issue - https://github.com/DockYard/ember-suave/releases/tag/v2.0.0 - fix linting errors arising from new rules
24 lines
770 B
JavaScript
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);
|
|
}
|
|
}
|
|
});
|