From e2bfcdb8d56675b905dce14a62e3912ef14ad4d8 Mon Sep 17 00:00:00 2001 From: Prajjwal Yadav Date: Sun, 17 Dec 2023 15:37:51 +0530 Subject: [PATCH 1/2] linked eventspage with the backend --- src/components/EventsPage.vue | 617 +++++++++++++++++----------------- 1 file changed, 312 insertions(+), 305 deletions(-) diff --git a/src/components/EventsPage.vue b/src/components/EventsPage.vue index 1dc6dcb..f1f34b8 100644 --- a/src/components/EventsPage.vue +++ b/src/components/EventsPage.vue @@ -1,312 +1,319 @@ \ No newline at end of file +import NavBar from "./NavBar.vue"; + +export default { + name: "EventsPage", + components: { + NavBar, + }, + data() { + return { + latestEvents: [], + upcomingEvents: [], + }; + }, + mounted() { + // Fetch events when the component is mounted + this.fetchEvents(); + }, + methods: { + fetchEvents() { + // Replace with your actual API endpoint + fetch("https://sundarbans.camlio.shop/events", { mode: "cors" }) + .then((response) => { + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`); + } + return response.json(); + }) + .then((data) => { + console.log("API Response:", data); // Log the entire response + // Separate events into latest and upcoming + this.latestEvents = data.latest_events || []; + this.upcomingEvents = data.uocoming_events || []; + }) + .catch((error) => { + console.error("Error fetching events:", error); + }); + }, + prependBackendLink(url) { + // Replace with your actual backend link + const backendLink = "https://sundarbans.camlio.shop"; + // Check if the URL already starts with 'http' or '/' + return url && url.startsWith("/") ? backendLink + url : url; + }, + }, +}; + From 0fd88f76c0111ad95c3f02a3660631b444b2cb85 Mon Sep 17 00:00:00 2001 From: Prajjwal Yadav Date: Sun, 17 Dec 2023 22:21:03 +0530 Subject: [PATCH 2/2] some changes in EventsPAge.vue --- src/components/EventsPage.vue | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/components/EventsPage.vue b/src/components/EventsPage.vue index f1f34b8..a7edabd 100644 --- a/src/components/EventsPage.vue +++ b/src/components/EventsPage.vue @@ -192,18 +192,23 @@ {{ event.desc }}

- {{ event.timestamp }} | Deadline: {{ event.deadline }} + {{ event.timestamp }}

- Status: {{ event.status }} + Deadline: {{ event.deadline }}

-

+ Status: {{ event.status }} +

--> + @@ -242,18 +247,18 @@ > {{ event.title }} -

{{ event.desc }} -

+

-->

{{ event.timestamp }}

-

Deadline: {{ event.deadline }} -

-

--> +