From a6b3747bfe91fca433481bd9f3903649f0961a05 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Tue, 22 Oct 2024 14:56:57 +0300 Subject: [PATCH] use POST method in refresh button event listener --- script.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index 63e4003..292d29f 100644 --- a/script.js +++ b/script.js @@ -80,8 +80,11 @@ function isValidUrl(url) { // Refresh button event listener refreshCalendarsButton.addEventListener('click', () => { if (mergedUrl) { + // Extract the calendar ID from the URL + const calendarId = mergedUrl.split('/').pop(); + // Call the server to refresh the merged calendar - fetch(`/refresh/${mergedUrl.split('/').pop()}`) // Extract the calendar ID from the URL + fetch(`/refresh/${calendarId}`, { method: 'POST' }) .then((response) => { if (!response.ok) { throw new Error('Failed to refresh calendar data');