fix: load maxAccounts from config on frontend init
The data store's fetchVersion() was never called, so maxAccounts stayed at the default value of 10. Consolidated into the global store's fetchVersion() which is called on init. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -136,24 +136,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;
|
|
||||||
}
|
|
||||||
// Store maxAccounts from config
|
|
||||||
if (data.config && typeof data.config.maxAccounts === 'number') {
|
|
||||||
this.maxAccounts = data.config.maxAccounts;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.warn('Failed to fetch version:', error);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async performHealthCheck() {
|
async performHealthCheck() {
|
||||||
try {
|
try {
|
||||||
// Get password from global store
|
// Get password from global store
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ document.addEventListener('alpine:init', () => {
|
|||||||
if (data.version) {
|
if (data.version) {
|
||||||
this.version = data.version;
|
this.version = data.version;
|
||||||
}
|
}
|
||||||
|
// Update maxAccounts in data store
|
||||||
|
if (data.config && typeof data.config.maxAccounts === 'number') {
|
||||||
|
Alpine.store('data').maxAccounts = data.config.maxAccounts;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.debug('Could not fetch version:', error);
|
console.debug('Could not fetch version:', error);
|
||||||
|
|||||||
Reference in New Issue
Block a user