Fix admin dashboard auto-refresh

This commit is contained in:
gpt-engineer-app[bot]
2025-10-06 18:36:43 +00:00
parent b1112e6261
commit f5c59aa072
5 changed files with 176 additions and 10 deletions

View File

@@ -126,6 +126,30 @@ export function useAdminSettings() {
return parseInt(value?.toString() || '30') * 1000; // Convert to milliseconds
};
/**
* Get auto-refresh strategy setting
* Returns: 'merge' | 'replace' | 'notify'
*/
const getAutoRefreshStrategy = (): 'merge' | 'replace' | 'notify' => {
const value = getSettingValue('auto_refresh_strategy', 'merge');
const cleanValue = typeof value === 'string' ? value.replace(/"/g, '') : value;
return cleanValue as 'merge' | 'replace' | 'notify';
};
/**
* Get preserve interaction state setting
* Returns: boolean
*/
const getPreserveInteractionState = (): boolean => {
const value = getSettingValue('preserve_interaction_state', 'true');
const cleanValue = typeof value === 'string' ? value.replace(/"/g, '') : value;
return cleanValue === 'true' || cleanValue === true;
};
const getNotificationRecipients = () => {
return getSettingValue('notifications.recipients', []);
};
return {
settings,
isLoading,
@@ -140,10 +164,13 @@ export function useAdminSettings() {
getRequireApproval,
getBanDurations,
getEmailAlertsEnabled,
getNotificationRecipients,
getReportThreshold,
getAuditRetentionDays,
getAutoCleanupEnabled,
getAdminPanelRefreshMode,
getAdminPanelPollInterval,
getAutoRefreshStrategy,
getPreserveInteractionState,
};
}