fix(shared): tag filter SQL precedence, balance cards filter by tag
This commit is contained in:
+4
-3
@@ -198,11 +198,12 @@ export function useParticipants() {
|
||||
});
|
||||
}
|
||||
|
||||
export function useParticipantBalances() {
|
||||
export function useParticipantBalances(tagIds?: string[]) {
|
||||
return useQuery<{ id: number; name: string; total_owed: number; unsettled_count: number }[]>({
|
||||
queryKey: ["participant-balances"],
|
||||
queryKey: ["participant-balances", tagIds],
|
||||
queryFn: async () => {
|
||||
const res = await fetch("/api/participants/balances");
|
||||
const params = tagIds?.length ? `?tag_ids=${tagIds.join(",")}` : "";
|
||||
const res = await fetch(`/api/participants/balances${params}`);
|
||||
return res.json();
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user