2017-08-22 10:53:26 +03:00
|
|
|
import Route from '@ember/routing/route';
|
2023-10-04 16:28:58 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2022-01-17 12:34:55 +03:00
|
|
|
export default class Error404Route extends Route {
|
|
|
|
controllerName = 'error';
|
|
|
|
templateName = 'error';
|
2014-06-24 03:52:10 +04:00
|
|
|
|
2023-10-04 16:28:58 +03:00
|
|
|
@service router;
|
|
|
|
|
|
|
|
beforeModel(transition) {
|
|
|
|
// handle redirects for old routes
|
|
|
|
if (transition.to?.params?.path?.startsWith?.('editor-beta')) {
|
|
|
|
const [, type, postId] = transition.to.params.path.split('/');
|
|
|
|
|
|
|
|
const route = postId ? 'lexical-editor.edit' : 'lexical-editor.new';
|
|
|
|
const models = [type];
|
|
|
|
|
|
|
|
if (postId) {
|
|
|
|
models.push(postId);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.router.transitionTo(route, ...models);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
model() {
|
2014-06-24 03:52:10 +04:00
|
|
|
return {
|
|
|
|
status: 404
|
|
|
|
};
|
2022-01-17 12:34:55 +03:00
|
|
|
}
|
2019-05-20 18:16:19 +03:00
|
|
|
|
|
|
|
buildRouteInfoMetadata() {
|
|
|
|
return {
|
2022-05-16 17:22:52 +03:00
|
|
|
titleToken: 'Error'
|
2019-05-20 18:16:19 +03:00
|
|
|
};
|
2014-06-24 03:52:10 +04:00
|
|
|
}
|
2022-01-17 12:34:55 +03:00
|
|
|
}
|