fix: resolve database connection error for analytics settings
Mirror to GitHub / mirror (push) Successful in 20s
Test and Lint / backend-test (push) Successful in 1m10s
continuous-integration/drone/push Build is passing
Test and Lint / frontend-test (push) Successful in 2m23s
Version and Release / version-bump (push) Successful in 32s
Version and Release / trigger-drone (push) Successful in 3s
Mirror to GitHub / mirror (push) Successful in 20s
Test and Lint / backend-test (push) Successful in 1m10s
continuous-integration/drone/push Build is passing
Test and Lint / frontend-test (push) Successful in 2m23s
Version and Release / version-bump (push) Successful in 32s
Version and Release / trigger-drone (push) Successful in 3s
- Update publicSettings.js to handle missing analytics setting_type gracefully - Add dedicated PUT /analytics endpoint for saving analytics settings - Update frontend settings service to route to correct endpoints based on setting type - Fix query to use WHERE clause that won't fail if analytics type doesn't exist This fixes the "Connection terminated unexpectedly" error when fetching public settings with analytics configuration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -162,7 +162,19 @@ export const settingsService = {
|
||||
|
||||
// Update multiple settings at once
|
||||
async updateSettings(settings: Record<string, any>): Promise<void> {
|
||||
await api.put('/admin/settings/general', settings);
|
||||
// Determine the endpoint based on setting keys
|
||||
const firstKey = Object.keys(settings)[0];
|
||||
let endpoint = '/admin/settings/general';
|
||||
|
||||
if (firstKey?.startsWith('security_')) {
|
||||
endpoint = '/admin/settings/security';
|
||||
} else if (firstKey?.startsWith('analytics_')) {
|
||||
endpoint = '/admin/settings/analytics';
|
||||
} else if (firstKey?.startsWith('branding_')) {
|
||||
endpoint = '/admin/settings/branding';
|
||||
}
|
||||
|
||||
await api.put(endpoint, settings);
|
||||
},
|
||||
|
||||
// Get storage information
|
||||
|
||||
Reference in New Issue
Block a user