diff options
author | Nick Van Doorn <vandoorn.nick@gmail.com> | 2019-04-06 12:37:33 -0700 |
---|---|---|
committer | Nick Van Doorn <vandoorn.nick@gmail.com> | 2019-04-06 12:37:38 -0700 |
commit | eb6f3aed5affcf340f0eee01bc8ef6a118b4f7e7 (patch) | |
tree | c4874f6501cfe21f7badb10bbc6cb2750bfbea42 /src | |
parent | 8cbfdc58b9c5c18c2873b80889684f42d4ea2dfb (diff) |
Couple URL helpers to global window
Make dat monad put in work for me.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/url.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/url.js b/src/lib/url.js index b3ef40c..83a8d12 100644 --- a/src/lib/url.js +++ b/src/lib/url.js @@ -1,8 +1,9 @@ -import { location, history } from 'browser-monads' -export const parseQuery = ({ search } = location) => - search && parseQueryString(search) +import { window } from 'browser-monads' -const parseQueryString = query => +export const parseQuery = () => + window.location.search && parseQueryString(window.location.search) + +export const parseQueryString = query => query .split('?')[1] .split('&') @@ -20,6 +21,6 @@ export const objectToQuery = query => '?' ) -export const writeQuery = (queryObj, { pushState } = history) => { - pushState({}, '', objectToQuery(queryObj)) +export const writeQuery = queryObj => { + window.history.pushState({}, '', objectToQuery(queryObj)) } |