UNPKG

612 BJavaScriptView Raw
1import { useLocation } from 'react-router';
2import qs from 'qs';
3import decodeUrlQuery from '../../helpers/decodeUrlQuery';
4export function useVariantFromUrl() {
5 const location = useLocation();
6 const urlQuery = qs.parse(location.search, { ignoreQueryPrefix: true });
7 if (!(urlQuery === null || urlQuery === void 0 ? void 0 : urlQuery.att))
8 return {};
9 const selectedVariantNames = decodeUrlQuery({
10 urlQuery,
11 parametersToBeDecoded: ['att']
12 }).att;
13 const values = selectedVariantNames.split('|');
14 return { values };
15}
16//# sourceMappingURL=useVariantFromUrl.js.map
\No newline at end of file