diff --git a/script.js b/script.js index ed01cf8..6460c52 100644 --- a/script.js +++ b/script.js @@ -41,7 +41,12 @@ const form = document.getElementById('merge-form'); }, body: JSON.stringify({ calendars: calendarsData }) }) - .then((response) => response.json()) + .then((response) => { + if (!response.ok) { + return response.json().then(err => { throw err; }); + } + return response.json(); + }) .then((data) => { result.innerHTML = `Merged calendar URL: ${data.url}`; console.log('Links added successfully!');