add pending approvals count to sidebar

This commit is contained in:
miloschwartz
2026-01-19 21:25:28 -08:00
parent f143d2e214
commit 0b8068e13d
6 changed files with 229 additions and 20 deletions

View File

@@ -377,5 +377,17 @@ export const approvalQueries = {
});
return res.data.data;
}
}),
pendingCount: (orgId: string) =>
queryOptions({
queryKey: ["APPROVALS", orgId, "COUNT", "pending"] as const,
queryFn: async ({ signal, meta }) => {
const res = await meta!.api.get<
AxiosResponse<{ count: number }>
>(`/org/${orgId}/approvals/count?approvalState=pending`, {
signal
});
return res.data.data.count;
}
})
};