Skip to content

Commit

Permalink
fix: change to append event name if it is in template
Browse files Browse the repository at this point in the history
  • Loading branch information
syam babu committed Feb 1, 2024
1 parent 5ab5e4c commit cbca1b2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ const Card = ({ id, name, place, image, startDate, endDate }) => {
const { widgetProps } = useContext(WidgetContext);
const { eventUrl, locale } = widgetProps;

let url = eventUrl.replace('${locale}', locale).replace('${eventId}', id);

if (url.includes('${eventName}')) {
url = url.replace('${eventName}', name);
}

return (
<li
className="card"
onClick={(e) => {
e.preventDefault();
redirectionHandler({
url: eventUrl.replace('${locale}', locale).replace('${eventId}', id),
url,
});
}}
>
Expand Down

0 comments on commit cbca1b2

Please sign in to comment.