1
0
Fork 0

send input data in the /add-links endpoint to server

This commit is contained in:
Ryan Mwangi 2024-10-14 15:46:58 +03:00
parent 276e41cc8f
commit 14e7db9c21
1 changed files with 15 additions and 0 deletions

View File

@ -42,7 +42,22 @@ const form = document.getElementById('merge-form');
console.error(error); console.error(error);
result.innerHTML = 'Error merging calendars'; 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 const refreshInterval = 60 * 60 * 1000; // 1 hour
setInterval(() => { setInterval(() => {
fetch('/merge') fetch('/merge')