Fix: support shvl on customapi dynamic list target

pull/5081/head
Matheus Peviani Vellone 3 weeks ago
parent 313835c0e6
commit 38431e8f38
No known key found for this signature in database
GPG Key ID: F7A14B715BE093E8

@ -245,7 +245,11 @@ export default function Component({ service }) {
listItems.map((item, index) => {
const itemName = shvl.get(item, name, "");
const itemLabel = shvl.get(item, label, "");
const itemUrl = target ? target.replace(/\{([^}]+)\}/g, (_, key) => item[key] || "") : null;
const itemUrl = target ? [...target.matchAll(/\{(.*?)\}/g)].map((match) => match[1]).targetReplaces.reduce((url, targetTemplate) => {
const value = shvl.get(item, targetTemplate, "");
return url.replaceAll(`{${targetTemplate}}`, value);
}, target) : null;
const className =
"bg-theme-200/50 dark:bg-theme-900/20 rounded-sm m-1 flex-1 flex flex-row items-center justify-between p-1 text-xs";

Loading…
Cancel
Save