Skip to content

Commit

Permalink
fix: changed from event name to slug for routing to site url
Browse files Browse the repository at this point in the history
  • Loading branch information
syam babu committed Feb 2, 2024
1 parent cbca1b2 commit f7d79c6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import './card.css';
import { redirectionHandler } from '../../utils/redirectionHandler';
import WidgetContext from '../../context/WidgetContext';

const Card = ({ id, name, place, image, startDate, endDate }) => {
const Card = ({ id, slug, name, place, image, startDate, endDate }) => {
const [imgError, setImgError] = useState(false);
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);
url = url.replace('${eventName}', slug);
}

return (
Expand Down
1 change: 1 addition & 0 deletions src/components/results/Results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const Results = () => {
key={index}
id={item?.id}
name={item?.title}
slug={item?.slug}
startDate={item?.startDate}
endDate={item?.endDate}
place={item?.streetAddress}
Expand Down
1 change: 1 addition & 0 deletions src/utils/transformData.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const transformData = ({ data, locale }) => {
return {
id: eventData.id,
title: title,
slug: eventData.slug?.[locale],
startDate:
eventData.subEventDetails.upcomingSubEventCount === 0
? eventData?.startDate || eventData?.startDateTime || ''
Expand Down

0 comments on commit f7d79c6

Please sign in to comment.