upgraded to react router v4
This commit is contained in:
@@ -13,8 +13,7 @@ import CenteredContent from 'components/CenteredContent';
|
||||
import DocumentPreview from 'components/DocumentPreview';
|
||||
|
||||
type Props = {
|
||||
route: Object,
|
||||
routeParams: Object,
|
||||
notFound: ?boolean,
|
||||
};
|
||||
|
||||
@observer class Search extends React.Component {
|
||||
@@ -26,20 +25,6 @@ type Props = {
|
||||
this.store = new SearchStore();
|
||||
}
|
||||
|
||||
componentDidMount = () => {
|
||||
const { splat } = this.props.routeParams;
|
||||
if (this.viewNotFound) {
|
||||
let searchTerm = _.last(splat.split('/'));
|
||||
searchTerm = searchTerm.split(/[\s-]+/gi).join(' ');
|
||||
this.store.search(searchTerm);
|
||||
}
|
||||
};
|
||||
|
||||
get viewNotFound(): boolean {
|
||||
const { sceneType } = this.props.route;
|
||||
return sceneType === 'notFound';
|
||||
}
|
||||
|
||||
render() {
|
||||
const search = _.debounce(searchTerm => {
|
||||
this.store.search(searchTerm);
|
||||
@@ -54,7 +39,7 @@ type Props = {
|
||||
loading={this.store.isFetching}
|
||||
>
|
||||
<CenteredContent>
|
||||
{this.viewNotFound &&
|
||||
{this.props.notFound &&
|
||||
<div>
|
||||
<h1>Not Found</h1>
|
||||
<p>We're unable to find the page you're accessing.</p>
|
||||
|
||||
Reference in New Issue
Block a user