finish setting refresh interval on client side

This commit is contained in:
Ryan Mwangi 2024-10-03 01:15:49 +03:00
parent 3f00b5558b
commit 5681530a27
1 changed files with 11 additions and 0 deletions

View File

@ -41,4 +41,15 @@ const form = document.getElementById('merge-form');
});
});
const refreshInterval = 60 * 60 * 1000; // 1 hour
setInterval(() => {
fetch('/merge')
.then((response) => response.json())
.then((data) => {
result.innerHTML = `Merged calendar URL: <a href="${data.url}">${data.url}</a>`;
})
.catch((error) => {
console.error(error);
result.innerHTML = 'Error merging calendars';
});
}, refreshInterval);