upgraded to react router v4

This commit is contained in:
Jori Lallo
2017-05-17 00:11:13 -07:00
parent f70e2326c0
commit b25298c8f1
23 changed files with 245 additions and 230 deletions

View File

@@ -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>