diff options
Diffstat (limited to 'web/static/js')
| -rw-r--r-- | web/static/js/app.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/web/static/js/app.js b/web/static/js/app.js index b68b12a..a930b1f 100644 --- a/web/static/js/app.js +++ b/web/static/js/app.js @@ -91,15 +91,20 @@ async function refreshData() { `; try { - // Refresh current tab - const response = await fetch(`/tabs/refresh?tab=${currentTab}`, { + // Force API refresh (updates cache) + const refreshResponse = await fetch('/api/refresh', { method: 'POST' }); - if (!response.ok) throw new Error('Refresh failed'); + if (!refreshResponse.ok) throw new Error('Refresh failed'); + + // Reload current tab from cache + const tabResponse = await fetch(`/tabs/${currentTab}`); + + if (!tabResponse.ok) throw new Error('Tab reload failed'); // Get HTML response and update tab content - const html = await response.text(); + const html = await tabResponse.text(); document.getElementById('tab-content').innerHTML = html; // Update timestamp @@ -138,12 +143,18 @@ async function autoRefresh() { console.log(`Auto-refreshing ${currentTab} tab...`); try { - const response = await fetch(`/tabs/refresh?tab=${currentTab}`, { + // Force API refresh (updates cache) + const refreshResponse = await fetch('/api/refresh', { method: 'POST' }); - if (response.ok) { - const html = await response.text(); + if (!refreshResponse.ok) throw new Error('Refresh failed'); + + // Reload current tab from cache + const tabResponse = await fetch(`/tabs/${currentTab}`); + + if (tabResponse.ok) { + const html = await tabResponse.text(); document.getElementById('tab-content').innerHTML = html; updateLastUpdatedTime(); console.log('Auto-refresh successful'); |
