Fix: Skip non-podcast API calls in podcast-only mode

- AlertsBadge: Skip agent alerts fetch in podcast mode
- UserBadge: Skip system status fetch in podcast mode
- SystemStatusIndicator: Skip monitoring stats in podcast mode

This prevents 404 errors when frontend calls endpoints that don't exist in podcast-only demo mode.
This commit is contained in:
ajaysi
2026-04-06 14:58:53 +05:30
parent 0e3a611e57
commit d12fe6348e
3 changed files with 28 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import {
Avatar
} from '@mui/material';
import { apiClient } from '../../../api/client';
import { isPodcastOnlyDemoMode } from '../../../utils/demoMode';
import {
CheckCircle as HealthyIcon,
Warning as WarningIcon,
@@ -90,6 +91,19 @@ const SystemStatusIndicator: React.FC<SystemStatusIndicatorProps> = ({ className
const [, setCachePerf] = useState<{ hits: number; misses: number; hit_rate: number } | null>(null);
const fetchStatus = async () => {
// Skip system status checks in podcast-only mode (endpoint not available)
if (isPodcastOnlyDemoMode()) {
setStatusData({
status: 'unknown',
icon: '⚪',
recent_requests: 0,
recent_errors: 0,
error_rate: 0,
timestamp: new Date().toISOString()
});
return;
}
setLoading(true);
setError(null);

View File

@@ -5,6 +5,7 @@ import { Warning as WarningIcon, Error as ErrorIcon, Info as InfoIcon, CheckCirc
import { billingService } from '../../services/billingService';
import { useAuth } from '@clerk/clerk-react';
import { getTasksNeedingIntervention, TaskNeedingIntervention } from '../../api/schedulerDashboard';
import { isPodcastOnlyDemoMode } from '../../utils/demoMode';
import {
apiClient,
isBackendCooldownActive,
@@ -106,6 +107,12 @@ const AlertsBadge: React.FC<AlertsBadgeProps> = ({ colorMode = 'light' }) => {
const fetchAlerts = async () => {
if (!userId || isPollingRef.current) return;
// Skip alerts fetching in podcast-only mode (endpoints not available)
if (isPodcastOnlyDemoMode()) {
setLoading(false);
return;
}
if (isBackendCooldownActive()) {
logBackendCooldownSkipOnce('AlertsBadge');
return;

View File

@@ -4,6 +4,7 @@ import { useUser, useClerk } from '@clerk/clerk-react';
import { useSubscription } from '../../contexts/SubscriptionContext';
import SystemStatusIndicator from '../ContentPlanningDashboard/components/SystemStatusIndicator';
import UsageDashboard from './UsageDashboard';
import { isPodcastOnlyDemoMode } from '../../utils/demoMode';
import {
apiClient,
isBackendCooldownActive,
@@ -30,6 +31,12 @@ const UserBadge: React.FC<UserBadgeProps> = ({ colorMode = 'light' }) => {
// Fetch system status for status bulb
useEffect(() => {
// Skip system status checks in podcast-only mode (endpoint not available)
if (isPodcastOnlyDemoMode()) {
setSystemStatus('unknown');
return;
}
const fetchSystemStatus = async () => {
if (isBackendCooldownActive()) {
logBackendCooldownSkipOnce('UserBadge');