mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-23 05:16:38 +00:00
💄 filter by approval state
This commit is contained in:
@@ -321,13 +321,22 @@ export const approvalFiltersSchema = z.object({
|
||||
});
|
||||
|
||||
export const approvalQueries = {
|
||||
listApprovals: (orgId: string) =>
|
||||
listApprovals: (
|
||||
orgId: string,
|
||||
filters: z.infer<typeof approvalFiltersSchema>
|
||||
) =>
|
||||
queryOptions({
|
||||
queryKey: ["APPROVALS", orgId] as const,
|
||||
queryKey: ["APPROVALS", orgId, filters] as const,
|
||||
queryFn: async ({ signal, meta }) => {
|
||||
const sp = new URLSearchParams();
|
||||
|
||||
if (filters.approvalState) {
|
||||
sp.set("approvalState", filters.approvalState);
|
||||
}
|
||||
|
||||
const res = await meta!.api.get<
|
||||
AxiosResponse<ListApprovalsResponse>
|
||||
>(`/org/${orgId}/approvals`, {
|
||||
>(`/org/${orgId}/approvals?${sp.toString()}`, {
|
||||
signal
|
||||
});
|
||||
return res.data.data;
|
||||
|
||||
Reference in New Issue
Block a user