Finish updating CRL impl

This commit is contained in:
Tuan Dang
2024-08-22 11:55:19 -07:00
parent 1515dd8a71
commit 0cb95f36ff
27 changed files with 378 additions and 273 deletions
+4 -3
View File
@@ -1,4 +1,4 @@
export { CaRenewalType,CaStatus, CaType } from "./enums";
export { CaRenewalType, CaStatus, CaType } from "./enums";
export {
useCreateCa,
useCreateCertificate,
@@ -6,5 +6,6 @@ export {
useImportCaCertificate,
useRenewCa,
useSignIntermediate,
useUpdateCa} from "./mutations";
export { useGetCaById, useGetCaCert, useGetCaCerts, useGetCaCrl, useGetCaCsr } from "./queries";
useUpdateCa
} from "./mutations";
export { useGetCaById, useGetCaCert, useGetCaCerts, useGetCaCrls,useGetCaCsr } from "./queries";
+10 -8
View File
@@ -7,6 +7,7 @@ import { TCertificateAuthority } from "./types";
export const caKeys = {
getCaById: (caId: string) => [{ caId }, "ca"],
getCaCerts: (caId: string) => [{ caId }, "ca-cert"],
getCaCrls: (caId: string) => [{ caId }, "ca-crls"],
getCaCert: (caId: string) => [{ caId }, "ca-cert"],
getCaCsr: (caId: string) => [{ caId }, "ca-csr"],
getCaCrl: (caId: string) => [{ caId }, "ca-crl"]
@@ -73,16 +74,17 @@ export const useGetCaCsr = (caId: string) => {
});
};
export const useGetCaCrl = (caId: string) => {
export const useGetCaCrls = (caId: string) => {
return useQuery({
queryKey: caKeys.getCaCrl(caId),
queryKey: caKeys.getCaCrls(caId),
queryFn: async () => {
const {
data: { crl }
} = await apiRequest.get<{
crl: string;
}>(`/api/v1/pki/ca/${caId}/crl`);
return crl;
const { data } = await apiRequest.get<
{
id: string;
crl: string;
}[]
>(`/api/v1/pki/ca/${caId}/crls`);
return data;
},
enabled: Boolean(caId)
});