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:
@@ -21,6 +21,7 @@ import {
|
|||||||
Avatar
|
Avatar
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import { apiClient } from '../../../api/client';
|
import { apiClient } from '../../../api/client';
|
||||||
|
import { isPodcastOnlyDemoMode } from '../../../utils/demoMode';
|
||||||
import {
|
import {
|
||||||
CheckCircle as HealthyIcon,
|
CheckCircle as HealthyIcon,
|
||||||
Warning as WarningIcon,
|
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 [, setCachePerf] = useState<{ hits: number; misses: number; hit_rate: number } | null>(null);
|
||||||
|
|
||||||
const fetchStatus = async () => {
|
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);
|
setLoading(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { Warning as WarningIcon, Error as ErrorIcon, Info as InfoIcon, CheckCirc
|
|||||||
import { billingService } from '../../services/billingService';
|
import { billingService } from '../../services/billingService';
|
||||||
import { useAuth } from '@clerk/clerk-react';
|
import { useAuth } from '@clerk/clerk-react';
|
||||||
import { getTasksNeedingIntervention, TaskNeedingIntervention } from '../../api/schedulerDashboard';
|
import { getTasksNeedingIntervention, TaskNeedingIntervention } from '../../api/schedulerDashboard';
|
||||||
|
import { isPodcastOnlyDemoMode } from '../../utils/demoMode';
|
||||||
import {
|
import {
|
||||||
apiClient,
|
apiClient,
|
||||||
isBackendCooldownActive,
|
isBackendCooldownActive,
|
||||||
@@ -106,6 +107,12 @@ const AlertsBadge: React.FC<AlertsBadgeProps> = ({ colorMode = 'light' }) => {
|
|||||||
const fetchAlerts = async () => {
|
const fetchAlerts = async () => {
|
||||||
if (!userId || isPollingRef.current) return;
|
if (!userId || isPollingRef.current) return;
|
||||||
|
|
||||||
|
// Skip alerts fetching in podcast-only mode (endpoints not available)
|
||||||
|
if (isPodcastOnlyDemoMode()) {
|
||||||
|
setLoading(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isBackendCooldownActive()) {
|
if (isBackendCooldownActive()) {
|
||||||
logBackendCooldownSkipOnce('AlertsBadge');
|
logBackendCooldownSkipOnce('AlertsBadge');
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useUser, useClerk } from '@clerk/clerk-react';
|
|||||||
import { useSubscription } from '../../contexts/SubscriptionContext';
|
import { useSubscription } from '../../contexts/SubscriptionContext';
|
||||||
import SystemStatusIndicator from '../ContentPlanningDashboard/components/SystemStatusIndicator';
|
import SystemStatusIndicator from '../ContentPlanningDashboard/components/SystemStatusIndicator';
|
||||||
import UsageDashboard from './UsageDashboard';
|
import UsageDashboard from './UsageDashboard';
|
||||||
|
import { isPodcastOnlyDemoMode } from '../../utils/demoMode';
|
||||||
import {
|
import {
|
||||||
apiClient,
|
apiClient,
|
||||||
isBackendCooldownActive,
|
isBackendCooldownActive,
|
||||||
@@ -30,6 +31,12 @@ const UserBadge: React.FC<UserBadgeProps> = ({ colorMode = 'light' }) => {
|
|||||||
|
|
||||||
// Fetch system status for status bulb
|
// Fetch system status for status bulb
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// Skip system status checks in podcast-only mode (endpoint not available)
|
||||||
|
if (isPodcastOnlyDemoMode()) {
|
||||||
|
setSystemStatus('unknown');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const fetchSystemStatus = async () => {
|
const fetchSystemStatus = async () => {
|
||||||
if (isBackendCooldownActive()) {
|
if (isBackendCooldownActive()) {
|
||||||
logBackendCooldownSkipOnce('UserBadge');
|
logBackendCooldownSkipOnce('UserBadge');
|
||||||
|
|||||||
Reference in New Issue
Block a user