aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/components/container/Search.js
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-02-19 22:49:26 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-02-19 22:49:26 +0100
commit5be066cc2714ca6cbd75d8786c859d8767df0ccb (patch)
tree4b9b66e68612eb9df03a73453907031c03420415 /src/client/react/components/container/Search.js
parent50671ed027f874992ac50cfb21e123f579440737 (diff)
Merge reducers into single file
Diffstat (limited to 'src/client/react/components/container/Search.js')
-rw-r--r--src/client/react/components/container/Search.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/client/react/components/container/Search.js b/src/client/react/components/container/Search.js
index 1c4ca4f..30ccad8 100644
--- a/src/client/react/components/container/Search.js
+++ b/src/client/react/components/container/Search.js
@@ -64,13 +64,13 @@ class Search extends React.Component {
componentDidMount() {
const urlUser = userFromMatch(this.props.match);
- this.props.dispatch({ type: 'SEARCH/SET_USERS', urlUser });
+ this.props.dispatch({ type: 'SEARCH/SET_USER', user: urlUser });
}
componentWillReceiveProps(nextProps) {
if (nextProps.match !== this.props.match) {
const urlUser = userFromMatch(nextProps.match);
- this.props.dispatch({ type: 'SEARCH/SET_USERS', urlUser });
+ this.props.dispatch({ type: 'SEARCH/SET_USER', user: urlUser });
}
}
@@ -103,7 +103,7 @@ class Search extends React.Component {
case 'Escape':
event.preventDefault();
- this.props.dispatch({ type: 'SEARCH/SET_USERS', urlUser });
+ this.props.dispatch({ type: 'SEARCH/SET_USER', user: urlUser });
break;
case 'Enter':
@@ -112,7 +112,7 @@ class Search extends React.Component {
// EDGE CASE: The user is set if the user changes, but it doesn't
// change if the result is already the one we are viewing.
// Therefor, we need to dispatch the SET_USER command manually.
- this.props.dispatch({ type: 'SEARCH/SET_USERS', urlUser });
+ this.props.dispatch({ type: 'SEARCH/SET_USER', user: urlUser });
} else if (result) {
this.props.history.push(`/${result}`);
}
@@ -170,9 +170,8 @@ class Search extends React.Component {
const mapStateToProps = state => ({
results: state.search.results,
- searchText: state.search.searchText,
- selectedResult: state.search.selectedResult,
- isExactMatch: state.search.isExactMatch,
+ searchText: state.search.text,
+ selectedResult: state.search.selected,
});
export default withRouter(connect(mapStateToProps)(Search));