1 | import { useLocation } from 'react-router';
|
2 | import qs from 'qs';
|
3 | import decodeUrlQuery from '../../helpers/decodeUrlQuery';
|
4 | export 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 |
|
\ | No newline at end of file |