Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/widgets/customapi/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,15 @@ 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])
.reduce((url, targetTemplate) => {
const value = shvl.get(item, targetTemplate, 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";

Expand Down