feat(platform): route vehicle searches to detail
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user