feat: add агегку events

This commit is contained in:
2026-08-14 15:50:25 +03:00
parent 719a6ed8b7
commit da55de5b50
13 changed files with 855 additions and 6 deletions
@@ -0,0 +1,25 @@
import { useQuery } from "@tanstack/react-query";
import { apiQueryClient } from "@/shared/api";
import type { paths } from "@/shared/api/generated/schema";
type EventsEndpoint =
paths["/api/v1/brokerage-accounts/{accountId}/events"]["get"];
export type BrokerageEvent =
EventsEndpoint["responses"][200]["content"]["application/json"]["events"][number];
export function useBrokerageEvents(
accountId: string | undefined,
accessToken: string | null,
) {
return useQuery({
queryKey: ["brokerage-events", accountId ?? ""] as const,
enabled: Boolean(accountId && accessToken),
staleTime: 30_000,
retry: false,
...apiQueryClient.queryOptions(
"get",
"/api/v1/brokerage-accounts/{accountId}/events",
{ params: { path: { accountId: accountId ?? "" } } },
),
});
}