improve error handling on refresh button event listener
This commit is contained in:
parent
a6b3747bfe
commit
c570cd9054
|
@ -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();
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue