frontend


frontend / api/analytics/hooks / usePriceTrendQuery

Function: usePriceTrendQuery()

usePriceTrendQuery(params, enabled): UseQueryResult<PricePoint[], Error>

Defined in: src/api/analytics/hooks/usePriceAndFinancials.ts:42

Hook to load price trend for a specific item. Shows historical price changes over time.

Parameters

params

Item ID, date range, optional supplier filter

end

string = ...

itemId

string = ...

start

string = ...

supplierId?

string = ...

enabled

boolean = true

Whether to fetch (defaults to true)

Returns

UseQueryResult<PricePoint[], Error>

React Query result with price points

Example

const { data: prices } = usePriceTrendQuery({
  itemId: 'ITEM-123',
  start: '2025-09-01',
  end: '2025-11-30'
});

return <LineChart data={prices} />;