From 5681530a2744c4ed7e4d4ba5f75dbce4a34647bc Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Thu, 3 Oct 2024 01:15:49 +0300 Subject: [PATCH] finish setting refresh interval on client side --- script.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/script.js b/script.js index 29e81c2..530b79d 100644 --- a/script.js +++ b/script.js @@ -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: ${data.url}`; + }) + .catch((error) => { + console.error(error); + result.innerHTML = 'Error merging calendars'; + }); + }, refreshInterval); \ No newline at end of file