approval list UI

This commit is contained in:
Fred KISSIE
2026-01-10 02:37:50 +01:00
parent 19c3efc9e9
commit 262376aa75
7 changed files with 230 additions and 12 deletions

View File

@@ -21,6 +21,7 @@ import type {
} from "@server/routers/resource";
import type { ListTargetsResponse } from "@server/routers/target";
import type { ListDomainsResponse } from "@server/routers/domain";
import type { ListApprovalsResponse } from "@server/private/routers/approvals";
export type ProductUpdate = {
link: string | null;
@@ -311,3 +312,25 @@ export const resourceQueries = {
}
})
};
export const approvalFiltersSchema = z.object({
approvalState: z
.enum(["pending", "approved", "denied", "all"])
.optional()
.catch("pending")
});
export const approvalQueries = {
listApprovals: (orgId: string) =>
queryOptions({
queryKey: ["APPROVALS", orgId] as const,
queryFn: async ({ signal, meta }) => {
const res = await meta!.api.get<
AxiosResponse<ListApprovalsResponse>
>(`/org/${orgId}/approvals`, {
signal
});
return res.data.data;
}
})
};