forked from ryanmwangi/CalMerger
use POST method in refresh button event listener
This commit is contained in:
parent
c6117e3470
commit
a6b3747bfe
|
@ -80,8 +80,11 @@ function isValidUrl(url) {
|
||||||
// Refresh button event listener
|
// Refresh button event listener
|
||||||
refreshCalendarsButton.addEventListener('click', () => {
|
refreshCalendarsButton.addEventListener('click', () => {
|
||||||
if (mergedUrl) {
|
if (mergedUrl) {
|
||||||
|
// Extract the calendar ID from the URL
|
||||||
|
const calendarId = mergedUrl.split('/').pop();
|
||||||
|
|
||||||
// Call the server to refresh the merged calendar
|
// 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) => {
|
.then((response) => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('Failed to refresh calendar data');
|
throw new Error('Failed to refresh calendar data');
|
||||||
|
|
Loading…
Reference in New Issue