|
|
@ -44,7 +44,16 @@ const keysToQuery = keys =>
|
|
|
|
.map(key => `${key}=${keys[key]}`)
|
|
|
|
.map(key => `${key}=${keys[key]}`)
|
|
|
|
.join('&')}`
|
|
|
|
.join('&')}`
|
|
|
|
|
|
|
|
|
|
|
|
export const getQueryStringState = query => mapper.map(mappings, query)
|
|
|
|
export const getQueryStringState = query => {
|
|
|
|
|
|
|
|
const state = mapper.map(mappings, query)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.keys(state).forEach(key => {
|
|
|
|
|
|
|
|
if (state[key] === '') state[key] = undefined
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export const updateQueryString = state =>
|
|
|
|
export const updateQueryString = state =>
|
|
|
|
history.replace({
|
|
|
|
history.replace({
|
|
|
|
search: encodeURI(keysToQuery(mapper.map(reverseMappings, state)))
|
|
|
|
search: encodeURI(keysToQuery(mapper.map(reverseMappings, state)))
|
|
|
|