artifacts-dashboard/frontend/src/hooks/use-events.ts
Paweł Orzech 2484a40dbd
Fix Grand Exchange: use public browse endpoint, fix price capture, add proper tabs
- Market tab now calls GET /grandexchange/orders (all public orders) instead of
  /my/grandexchange/orders (own orders only), fixing the empty exchange issue
- Fix capture_prices reading "type" field instead of wrong "order" field
- Add proper pagination to all GE queries via _get_paginated
- Separate My Orders (active own orders) from Trade History (transaction log)
- Add GEHistoryEntry type matching GeOrderHistorySchema (order_id, seller, buyer, sold_at)
- Add /api/exchange/my-orders and /api/exchange/sell-history endpoints
- Exchange page now has 4 tabs: Market, My Orders, Trade History, Price History
2026-03-01 20:38:19 +01:00

21 lines
532 B
TypeScript

"use client";
import { useQuery } from "@tanstack/react-query";
import { getEvents, getEventHistory } from "@/lib/api-client";
import type { ActiveGameEvent, HistoricalEvent } from "@/lib/types";
export function useEvents() {
return useQuery<ActiveGameEvent[]>({
queryKey: ["events"],
queryFn: getEvents,
refetchInterval: 10000,
});
}
export function useEventHistory() {
return useQuery<HistoricalEvent[]>({
queryKey: ["events", "history"],
queryFn: getEventHistory,
refetchInterval: 30000,
});
}