feat(platform): route vehicle searches to detail

This commit is contained in:
lingniu
2026-07-03 21:37:32 +08:00
parent d4bd70fdf4
commit 92d7020b36
4 changed files with 56 additions and 30 deletions

View File

@@ -11,12 +11,8 @@ type VehicleQuery = {
protocol?: string;
};
const defaultQuery: VehicleQuery = {
vin: 'LB9A32A24R0LS1426'
};
export function VehicleDetail() {
const [query, setQuery] = useState<VehicleQuery>(defaultQuery);
export function VehicleDetail({ vin }: { vin: string }) {
const [query, setQuery] = useState<VehicleQuery>({ vin });
const [detail, setDetail] = useState<VehicleDetailData | null>(null);
const [loading, setLoading] = useState(false);
@@ -38,8 +34,10 @@ export function VehicleDetail() {
};
useEffect(() => {
load(defaultQuery);
}, []);
const nextQuery = { vin };
setQuery(nextQuery);
load(nextQuery);
}, [vin]);
const identity = detail?.identity;
const latest = detail?.realtime[0];