diff options
Diffstat (limited to 'src/client/react/lib')
-rw-r--r-- | src/client/react/lib/url.js | 13 |
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}`); +} |