aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-06-27 16:45:50 +0200
committerNoah Loomans <noahloomans@gmail.com>2018-06-27 16:45:50 +0200
commit9e55c4b1a151b434cba4b4425514c3aeac6f22d8 (patch)
treefc77255f2b6e696eec435e3319df1546da8e5d0d
parent3bfff2ec9bec03030d2cecd9d57880bcfde740f7 (diff)
Only use history in makeSetUser and makeSetWeek
-rw-r--r--src/client/react/components/container/Menu.js4
-rw-r--r--src/client/react/components/container/Results.js4
-rw-r--r--src/client/react/components/container/RoomFinder.js4
-rw-r--r--src/client/react/components/container/Search.js4
-rw-r--r--src/client/react/components/container/WeekSelector.js4
-rw-r--r--src/client/react/lib/url.js10
6 files changed, 15 insertions, 15 deletions
diff --git a/src/client/react/components/container/Menu.js b/src/client/react/components/container/Menu.js
index 5a18a8d..0e81fde 100644
--- a/src/client/react/components/container/Menu.js
+++ b/src/client/react/components/container/Menu.js
@@ -28,8 +28,8 @@ const mapStateToProps = (state, { match }) => ({
user: userFromMatch(match),
});
-const mapDispatchToProps = (dispatch, { location, history }) => ({
- setUser: makeSetUser(location, history),
+const mapDispatchToProps = (dispatch, { history }) => ({
+ setUser: makeSetUser(history),
showRoomFinder: () => dispatch({ type: 'ROOM_FINDER/SHOW' }),
});
diff --git a/src/client/react/components/container/Results.js b/src/client/react/components/container/Results.js
index 773e469..c20fdc4 100644
--- a/src/client/react/components/container/Results.js
+++ b/src/client/react/components/container/Results.js
@@ -101,8 +101,8 @@ const mapStateToProps = (state, { match }) => ({
selectedResult: state.search.result,
});
-const mapDispatchToProps = (dispatch, { location, history }) => ({
- setUser: makeSetUser(location, history),
+const mapDispatchToProps = (dispatch, { history }) => ({
+ setUser: makeSetUser(history),
dispatch,
});
diff --git a/src/client/react/components/container/RoomFinder.js b/src/client/react/components/container/RoomFinder.js
index c8c506b..8bcccc4 100644
--- a/src/client/react/components/container/RoomFinder.js
+++ b/src/client/react/components/container/RoomFinder.js
@@ -105,8 +105,8 @@ const mapStateToProps = (state, { match }) => ({
isVisible: state.isRoomFinderVisible,
});
-const mapDispatchToProps = (dispatch, { location, history }) => ({
- setUser: makeSetUser(location, history),
+const mapDispatchToProps = (dispatch, { history }) => ({
+ setUser: makeSetUser(history),
onHide: () => dispatch({ type: 'ROOM_FINDER/HIDE' }),
});
diff --git a/src/client/react/components/container/Search.js b/src/client/react/components/container/Search.js
index fc741c6..865a0bc 100644
--- a/src/client/react/components/container/Search.js
+++ b/src/client/react/components/container/Search.js
@@ -189,8 +189,8 @@ const mapStateToProps = state => ({
selectedResult: state.search.selected,
});
-const mapDispatchToProps = (dispatch, { location, history }) => ({
- setUser: makeSetUser(location, history),
+const mapDispatchToProps = (dispatch, { history }) => ({
+ setUser: makeSetUser(history),
dispatch,
});
diff --git a/src/client/react/components/container/WeekSelector.js b/src/client/react/components/container/WeekSelector.js
index f927117..bc428cc 100644
--- a/src/client/react/components/container/WeekSelector.js
+++ b/src/client/react/components/container/WeekSelector.js
@@ -85,8 +85,8 @@ const mapStateToProps = (state, { location }) => ({
week: weekFromLocation(location),
});
-const mapDispatchToProps = (dispatch, { location, history }) => ({
- setWeek: makeSetWeek(location, history),
+const mapDispatchToProps = (dispatch, { history }) => ({
+ setWeek: makeSetWeek(history),
});
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(WeekSelector));
diff --git a/src/client/react/lib/url.js b/src/client/react/lib/url.js
index c94383c..644fd74 100644
--- a/src/client/react/lib/url.js
+++ b/src/client/react/lib/url.js
@@ -43,20 +43,20 @@ export function weekFromLocation(location) {
return purifyWeek(parseInt(weekStr, 10));
}
-export function makeSetUser(location, history) {
+export function makeSetUser(history) {
return (userId) => {
- const query = location.search;
+ const query = history.location.search;
history.push(`/${userId}${query}`);
};
}
-export function makeSetWeek(location, history) {
+export function makeSetWeek(history) {
return (week) => {
const query = queryString.stringify({
- ...queryString.parse(location.search),
+ ...queryString.parse(history.location.search),
week,
});
- history.push(`${location.pathname}?${query}`);
+ history.push(`${history.location.pathname}?${query}`);
};
}