Merge remote-tracking branch 'origin/main' into feature/est-simpleenroll

This commit is contained in:
Sheen Capadngan
2024-08-27 02:13:59 +08:00
98 changed files with 2176 additions and 827 deletions
+1 -1
View File
@@ -8,4 +8,4 @@ export {
useSignIntermediate,
useUpdateCa
} from "./mutations";
export { useGetCaById, useGetCaCert, useGetCaCerts, useGetCaCrl, useGetCaCsr } from "./queries";
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"],
@@ -74,16 +75,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)
});