All checks were successful
CI / ci (push) Successful in 15s
Run biome check --write --unsafe to fix tabs, import ordering, and non-null assertions across entire codebase. Disable a11y rules not applicable to this single-user app. Exclude auto-generated routeTree. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
620 B
TypeScript
32 lines
620 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { apiGet } from "../lib/api";
|
|
|
|
interface CategoryTotals {
|
|
categoryId: number;
|
|
categoryName: string;
|
|
categoryIcon: string;
|
|
totalWeight: number;
|
|
totalCost: number;
|
|
itemCount: number;
|
|
}
|
|
|
|
interface GlobalTotals {
|
|
totalWeight: number;
|
|
totalCost: number;
|
|
itemCount: number;
|
|
}
|
|
|
|
interface TotalsResponse {
|
|
categories: CategoryTotals[];
|
|
global: GlobalTotals;
|
|
}
|
|
|
|
export type { CategoryTotals, GlobalTotals, TotalsResponse };
|
|
|
|
export function useTotals() {
|
|
return useQuery({
|
|
queryKey: ["totals"],
|
|
queryFn: () => apiGet<TotalsResponse>("/api/totals"),
|
|
});
|
|
}
|