1
0
Fork 0

remove refresh calendar button event listener

This commit is contained in:
Ryan Mwangi 2024-10-25 14:54:25 +03:00
parent f0eb318f26
commit 4a88b0a5ec
1 changed files with 0 additions and 28 deletions

View File

@ -76,31 +76,3 @@ 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/${calendarId}`, { method: 'POST' })
.then((response) => {
if (!response.ok) {
return response.json().then(err => { throw err; });
}
return response.json();
})
.then((data) => {
result.innerHTML = `Merged calendar URL: <a href="${mergedUrl}">${mergedUrl}</a>`;
console.log('Calendar data refreshed successfully!');
})
.catch((error) => {
console.error('Error refreshing calendar data:', error);
result.innerHTML = `Error refreshing calendar data: ${error.message || 'Unknown error'}`;
});
} else {
alert('No merged calendar URL available to refresh.');
}
});