improve error handling on refresh button event listener

This commit is contained in:
Ryan Mwangi 2024-10-22 14:59:32 +03:00
parent a6b3747bfe
commit c570cd9054
1 changed files with 1 additions and 1 deletions

View File

@ -87,7 +87,7 @@ refreshCalendarsButton.addEventListener('click', () => {
fetch(`/refresh/${calendarId}`, { method: 'POST' }) fetch(`/refresh/${calendarId}`, { method: 'POST' })
.then((response) => { .then((response) => {
if (!response.ok) { if (!response.ok) {
throw new Error('Failed to refresh calendar data'); return response.json().then(err => { throw err; });
} }
return response.json(); return response.json();
}) })