feat(performance): consume investment performance API contract (WealthLedger/main#54)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { apiQueryClient, type paths, useAuthenticatedQuery } from "@/shared/api";
|
||||
|
||||
type Performance = NonNullable<
|
||||
paths["/api/v1/brokerage-accounts/{accountId}/performance"]["get"]["responses"][200]["content"]["application/json"]["data"]
|
||||
>;
|
||||
|
||||
function usePerformance(accountId: string) {
|
||||
return useAuthenticatedQuery({
|
||||
meta: { accessGroup: "brokerage" },
|
||||
...apiQueryClient.queryOptions(
|
||||
"get",
|
||||
"/api/v1/brokerage-accounts/{accountId}/performance",
|
||||
{ params: { path: { accountId } } },
|
||||
),
|
||||
enabled: Boolean(accountId),
|
||||
staleTime: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
export { type Performance, usePerformance };
|
||||
@@ -0,0 +1 @@
|
||||
export { type Performance, usePerformance } from "./api/usePerformance";
|
||||
Reference in New Issue
Block a user