Commit 2d8fcac9 authored by Hermann's avatar Hermann
Browse files

add 404 error page

parent 9cb6d6b8
......@@ -248,9 +248,10 @@ export class ResourceHandler {
})}`;
}
api.get(url).then((response) => {
if (response.status >= 400) {
if (response.status === 404) {
m.route.set('/404');
} else if (response.status >= 400) {
Snackbar.show({ title: response.data, style: { color: 'red' } });
resetSession();
reject();
} else {
resolve(response.data);
......
......@@ -10,7 +10,7 @@ import JobTable from './jobs/table';
import JobItem from './jobs/item';
import StudydocTable from './studydocs/list';
import studydocItem from './studydocs/item';
import { Layout } from './layout';
import { Layout, Error404 } from './layout';
import './style';
const root = document.body;
......@@ -43,4 +43,5 @@ m.route(root, '/events', {
'/studydocuments': layoutWith(StudydocTable),
'/studydocuments/:id': layoutWith(studydocItem),
'/newstudydocument': layoutWith(studydocItem),
'/404': layoutWith(Error404),
});
......@@ -192,3 +192,20 @@ export class loadingScreen {
}))));
}
}
export class Error404 {
view() {
return m('div', {
style: {
height: '100%',
width: '100%',
display: 'flex',
'flex-direction': 'column',
'justify-content': 'center',
'align-items': 'center',
},
}, [
m('div', { style: { height: '5vh', 'font-size': '4em' } }, 'Error 404: Item Not Found!'),
]);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment