diff --git a/public/js/data-store.js b/public/js/data-store.js index f361c89..ca36c8c 100644 --- a/public/js/data-store.js +++ b/public/js/data-store.js @@ -125,11 +125,6 @@ document.addEventListener('alpine:init', () => { this.computeQuotaRows(); this.lastUpdated = new Date().toLocaleTimeString(); - - // Fetch version from config endpoint if not already loaded - if (this.initialLoad) { - this.fetchVersion(password); - } } catch (error) { console.error('Fetch error:', error); const store = Alpine.store('global'); @@ -140,20 +135,6 @@ document.addEventListener('alpine:init', () => { } }, - async fetchVersion(password) { - try { - const { response } = await window.utils.request('/api/config', {}, password); - if (response.ok) { - const data = await response.json(); - if (data.version) { - Alpine.store('global').version = data.version; - } - } - } catch (error) { - console.warn('Failed to fetch version:', error); - } - }, - async performHealthCheck() { try { // Get password from global store diff --git a/public/js/store.js b/public/js/store.js index 3b13bb9..5166bb4 100644 --- a/public/js/store.js +++ b/public/js/store.js @@ -30,6 +30,23 @@ document.addEventListener('alpine:init', () => { this.activeTab = hash; } }); + + // 4. Fetch version from API + this.fetchVersion(); + }, + + async fetchVersion() { + try { + const response = await fetch('/api/config'); + if (response.ok) { + const data = await response.json(); + if (data.version) { + this.version = data.version; + } + } + } catch (error) { + console.debug('Could not fetch version:', error); + } }, // App State