diff options
Diffstat (limited to 'src/client/react/lib/url.js')
-rw-r--r-- | src/client/react/lib/url.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/client/react/lib/url.js b/src/client/react/lib/url.js index fcd3e6a..752fec2 100644 --- a/src/client/react/lib/url.js +++ b/src/client/react/lib/url.js @@ -70,3 +70,21 @@ export function makeSetWeek(history) { history.push(`${history.location.pathname}?${query}`); }; } + +export function makeUpdatePathname(history) { + return function updatePathname(pathname) { + const query = history.location.search; + history.push(`/${pathname}${query}`); + }; +} + +export function makeUpdateQuery(history) { + return function updateQuery(newQuery) { + const query = queryString.stringify({ + ...queryString.parse(history.location.search), + ...newQuery, + }); + + history.push(`${history.location.pathname}?${query}`); + }; +} |