From e19740ce3311a65a2f936f79e7768e970284f988 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Thu, 28 Sep 2017 17:18:28 -0700 Subject: [PATCH] Simple catch-all route for 404s on pages --- ui/app/router.js | 2 ++ ui/app/routes/not-found.js | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 ui/app/routes/not-found.js diff --git a/ui/app/router.js b/ui/app/router.js index ee03341de..a63b46fc4 100644 --- a/ui/app/router.js +++ b/ui/app/router.js @@ -35,6 +35,8 @@ Router.map(function() { if (config.environment === 'development') { this.route('freestyle'); } + + this.route('not-found', { path: '/*' }); }); export default Router; diff --git a/ui/app/routes/not-found.js b/ui/app/routes/not-found.js new file mode 100644 index 000000000..1974ee9ba --- /dev/null +++ b/ui/app/routes/not-found.js @@ -0,0 +1,11 @@ +import Ember from 'ember'; + +const { Route, Error: EmberError } = Ember; + +export default Route.extend({ + model() { + const err = new EmberError('Page not found'); + err.code = '404'; + this.controllerFor('application').set('error', err); + }, +});