forked from ryanmwangi/CalMerger
send input data in the /add-links endpoint to server
This commit is contained in:
parent
276e41cc8f
commit
14e7db9c21
15
script.js
15
script.js
|
@ -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')
|
||||||
|
|
Loading…
Reference in New Issue