mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
Log the previous location if a 404 is encountered
This commit is contained in:
parent
fce578e854
commit
7e77cb58dc
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { History } from 'react-router';
|
||||||
|
|
||||||
import { getLangText } from '../utils/lang_utils';
|
import { getLangText } from '../utils/lang_utils';
|
||||||
|
|
||||||
@ -10,12 +11,25 @@ let ErrorNotFoundPage = React.createClass({
|
|||||||
message: React.PropTypes.string
|
message: React.PropTypes.string
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mixins: [History],
|
||||||
|
|
||||||
getDefaultProps() {
|
getDefaultProps() {
|
||||||
return {
|
return {
|
||||||
message: getLangText("Oops, the page you are looking for doesn't exist.")
|
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() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="row">
|
<div className="row">
|
||||||
@ -32,4 +46,4 @@ let ErrorNotFoundPage = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default ErrorNotFoundPage;
|
export default ErrorNotFoundPage;
|
||||||
|
Loading…
Reference in New Issue
Block a user