fix selectable catalogs

This commit is contained in:
nklhrstv 2021-11-08 13:39:07 +02:00
parent c69c3fe1f4
commit c76e723523

View file

@ -49,17 +49,24 @@ const mapSelectableInputs = (discover) => {
isRequired: isRequired,
options: options.map(({ value, deepLinks }) => ({
label: typeof value === 'string' ? value : 'None',
value: deepLinks.discover
value: JSON.stringify({
href: deepLinks.discover,
value
})
})),
selected: options
.filter(({ selected }) => selected)
.map(({ deepLinks }) => deepLinks.discover),
.map(({ value, deepLinks }) => JSON.stringify({
href: deepLinks.discover,
value
})),
renderLabelText: options.some(({ selected, value }) => selected && value === null) ?
() => `Select ${name}`
:
null,
onSelect: (event) => {
window.location = event.value;
const { href } = JSON.parse(event.value);
window.location = href;
}
}));
const paginationInput = discover.selectable.prevPage || discover.selectable.nextPage ?