From 9470394383bb0105053937a149472189940016df Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Tue, 20 Mar 2018 16:12:36 +0100 Subject: Refactor RoomFinder --- src/client/react/lib/url.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/client/react/lib') 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}`); +} -- cgit v1.1