mirror of
https://github.com/getredash/redash.git
synced 2026-05-10 15:00:16 -04:00
* support date ranges for parameterized embeds * add qs * remove hideous implementation and use qs * get rid of apiKey querystring parameter and introduce query-string module
12 lines
421 B
JavaScript
12 lines
421 B
JavaScript
import qs from 'qs';
|
|
|
|
const parse = queryString => qs.parse(queryString, { allowDots: true, ignoreQueryPrefix: true });
|
|
const onlyParameters = ([k]) => k.startsWith('p_');
|
|
const removePrefix = ([k, v]) => [k.slice(2), v];
|
|
const toObject = (obj, [k, v]) => Object.assign(obj, { [k]: v });
|
|
|
|
export default () => Object.entries(parse(location.search))
|
|
.filter(onlyParameters)
|
|
.map(removePrefix)
|
|
.reduce(toObject, {});
|