forked from ryanmwangi/CalMerger
send one fetch request
This commit is contained in:
parent
46604e08f6
commit
c7f33d9160
1 changed files with 1 additions and 14 deletions
15
script.js
15
script.js
|
@ -39,25 +39,12 @@ const form = document.getElementById('merge-form');
|
|||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
result.innerHTML = `Merged calendar URL: <a href="${data.url}">${data.url}</a>`;
|
||||
console.log('Links added successfully!');
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
result.innerHTML = 'Error merging calendars';
|
||||
});
|
||||
|
||||
// Send the input data to the server
|
||||
fetch('/add-links', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ calendars: calendarsData })
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
console.log('Links added successfully!');
|
||||
}) .catch((error) => {
|
||||
console.error('Error adding links:', error);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
const refreshInterval = 60 * 60 * 1000; // 1 hour
|
||||
|
|
Loading…
Add table
Reference in a new issue