aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/lib
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-03-20 16:12:36 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-03-20 16:12:36 +0100
commit9470394383bb0105053937a149472189940016df (patch)
tree94bc7df1596f765dea1233facbf157982e750787 /src/client/react/lib
parentff2b3eb8f479065431d0a56b21fa931dac26880c (diff)
Refactor RoomFinder
Diffstat (limited to 'src/client/react/lib')
-rw-r--r--src/client/react/lib/url.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/client/react/lib/url.js b/src/client/react/lib/url.js
index a1fa2fe..77731fc 100644
--- a/src/client/react/lib/url.js
+++ b/src/client/react/lib/url.js
@@ -42,3 +42,16 @@ export function weekFromLocation(location) {
return purifyWeek(parseInt(weekStr, 10));
}
+
+export function setUser(userId, location, history) {
+ const query = location.search;
+ history.push(`/${userId}${query}`);
+}
+
+export function setWeek(week, location, history) {
+ const query = queryString.stringify({
+ ...queryString.parse(location.search),
+ week,
+ });
+ history.push(`${location.pathname}${query}`);
+}