import { Card, Table, Tabs, Toast } from '@douyinfe/semi-ui'; import { useEffect, useState } from 'react'; import { api } from '../api/client'; import type { RealtimeLocationRow } from '../api/types'; import { DataEmpty } from '../components/DataEmpty'; import { PageHeader } from '../components/PageHeader'; export function Realtime() { const [rows, setRows] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { api.realtimeLocations(new URLSearchParams({ limit: '50' })) .then((page) => setRows(page.items)) .catch((error: Error) => Toast.error(error.message)) .finally(() => setLoading(false)); }, []); return (
{rows.length === 0 && !loading ? ( ) : ( )}
{rows.map((row, index) => ( ))}
); }