Fix URL changing to homepage on 404

This commit is contained in:
Alexander Skvortsov 2021-04-13 01:21:13 -04:00
parent 235dfebfd4
commit 897dd578b8

View File

@ -24,6 +24,7 @@ import { flattenDeep } from 'lodash-es';
import PageState from './states/PageState';
import ModalManagerState from './states/ModalManagerState';
import AlertManagerState from './states/AlertManagerState';
import ErrorPage from './components/ErrorPage';
/**
* The `App` class provides a container for an application, as well as various
@ -199,6 +200,9 @@ export default class Application {
this.drawer = new Drawer();
// Needed so 404s don't get their URLs changed to the homepage.
// Won't affect extension routes since its added last.
this.routes.error = { path: '/:4xx...', component: ErrorPage };
m.route(document.getElementById('content'), basePath + '/', mapRoutes(this.routes, basePath));
// Add a class to the body which indicates that the page has been scrolled