chore: codify React component style
This commit is contained in:
@@ -4,14 +4,14 @@ import type { paths } from "@/shared/api/generated/schema";
|
||||
type OperationsEndpoint =
|
||||
paths["/api/v1/brokerage-accounts/{accountId}/operations"]["get"];
|
||||
|
||||
export type BrokerageOperation =
|
||||
type BrokerageOperation =
|
||||
OperationsEndpoint["responses"][200]["content"]["application/json"]["items"][number];
|
||||
type BrokerageOperationsQuery = NonNullable<
|
||||
OperationsEndpoint["parameters"]["query"]
|
||||
>;
|
||||
export type OperationCategory = BrokerageOperation["category"];
|
||||
type OperationCategory = BrokerageOperation["category"];
|
||||
|
||||
export const operationCategories = [
|
||||
const operationCategories = [
|
||||
"trade",
|
||||
"income",
|
||||
"tax",
|
||||
@@ -20,9 +20,7 @@ export const operationCategories = [
|
||||
"other",
|
||||
] as const satisfies readonly OperationCategory[];
|
||||
|
||||
export function brokerageOperationsQueryParams(
|
||||
query: BrokerageOperationsQuery,
|
||||
) {
|
||||
function brokerageOperationsQueryParams(query: BrokerageOperationsQuery) {
|
||||
return {
|
||||
...(query.from ? { from: query.from } : {}),
|
||||
...(query.to ? { to: query.to } : {}),
|
||||
@@ -34,7 +32,7 @@ export function brokerageOperationsQueryParams(
|
||||
};
|
||||
}
|
||||
|
||||
export function useBrokerageOperations(
|
||||
function useBrokerageOperations(
|
||||
accountId: string | undefined,
|
||||
query: BrokerageOperationsQuery = {},
|
||||
) {
|
||||
@@ -50,3 +48,11 @@ export function useBrokerageOperations(
|
||||
retry: false,
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
type BrokerageOperation,
|
||||
brokerageOperationsQueryParams,
|
||||
type OperationCategory,
|
||||
operationCategories,
|
||||
useBrokerageOperations,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user