27 lines
623 B
TypeScript
27 lines
623 B
TypeScript
import {
|
|
apiQueryClient,
|
|
type paths,
|
|
useAuthenticatedQuery,
|
|
} from "@/shared/api";
|
|
|
|
const brokerageAccountsQueryOptions = () =>
|
|
apiQueryClient.queryOptions("get", "/api/v1/brokerage-accounts");
|
|
|
|
const brokerageAccountsQueryKey = brokerageAccountsQueryOptions().queryKey;
|
|
|
|
type BrokerageAccount =
|
|
paths["/api/v1/brokerage-accounts"]["get"]["responses"][200]["content"]["application/json"][number];
|
|
|
|
function useBrokerageAccounts() {
|
|
return useAuthenticatedQuery({
|
|
...brokerageAccountsQueryOptions(),
|
|
staleTime: 60_000,
|
|
});
|
|
}
|
|
|
|
export {
|
|
type BrokerageAccount,
|
|
brokerageAccountsQueryKey,
|
|
useBrokerageAccounts,
|
|
};
|