1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Log the previous location if a 404 is encountered

This commit is contained in:
Brett Sun 2016-01-08 11:45:01 +01:00
parent fce578e854
commit 7e77cb58dc

View File

@ -1,6 +1,7 @@
'use strict';
import React from 'react';
import { History } from 'react-router';
import { getLangText } from '../utils/lang_utils';
@ -10,12 +11,25 @@ let ErrorNotFoundPage = React.createClass({
message: React.PropTypes.string
},
mixins: [History],
getDefaultProps() {
return {
message: getLangText("Oops, the page you are looking for doesn't exist.")
};
},
componentDidMount() {
// The previous page, if any, is the second item in the locationQueue
const { locationQueue: [ _, previousPage ] } = this.history;
if (previousPage) {
console.logGlobal('Page not found', {
previousPath: previousPage.pathname
});
}
},
render() {
return (
<div className="row">
@ -32,4 +46,4 @@ let ErrorNotFoundPage = React.createClass({
}
});
export default ErrorNotFoundPage;
export default ErrorNotFoundPage;