diff --git a/client/components/AIAccounts.tsx b/client/components/AIAccounts.tsx index 004346a..1feec5f 100644 --- a/client/components/AIAccounts.tsx +++ b/client/components/AIAccounts.tsx @@ -72,6 +72,7 @@ export function AIAccounts({ apiKey }: AIAccountsProps) { const [claudeAccounts, setClaudeAccounts] = useState([]); const [openaiAccounts, setOpenaiAccounts] = useState([]); const [isLoading, setIsLoading] = useState(true); + const [isRefreshing, setIsRefreshing] = useState(false); const [error, setError] = useState(''); useEffect(() => { @@ -80,7 +81,11 @@ export function AIAccounts({ apiKey }: AIAccountsProps) { return () => clearInterval(interval); }, [apiKey]); - const fetchAccounts = async () => { + const fetchAccounts = async (isRefresh = false) => { + if (isRefresh) { + setIsRefreshing(true); + } + try { const response = await fetch('/api/ai-accounts', { headers: { @@ -101,6 +106,9 @@ export function AIAccounts({ apiKey }: AIAccountsProps) { setError(err instanceof Error ? err.message : 'Failed to load AI accounts'); } finally { setIsLoading(false); + if (isRefresh) { + setIsRefreshing(false); + } } }; @@ -187,7 +195,7 @@ export function AIAccounts({ apiKey }: AIAccountsProps) {

{error}

+
{allAccounts.length > 0 ? (