frontend


frontend / api/analytics/hooks / useStockValueQuery

Function: useStockValueQuery()

useStockValueQuery(params, enabled): UseQueryResult<StockValuePoint[], Error>

Defined in: src/api/analytics/hooks/useStockAnalytics.ts:43

Hook to load stock value over time (trend chart data). Caches results for 5 minutes.

Parameters

params

Date range and optional supplier filter

from?

string = ...

supplierId?

string = ...

to?

string = ...

enabled

boolean = true

Whether to fetch (defaults to true)

Returns

UseQueryResult<StockValuePoint[], Error>

React Query result with stock value points

Example

const { data: points, isLoading } = useStockValueQuery({
  from: '2025-09-01',
  to: '2025-11-30',
  supplierId: 'SUP-001'
});

return <LineChart data={points} loading={isLoading} />;