mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 03:31:27 +00:00
Transfer cert endpoints to work with serial numbers
This commit is contained in:
@@ -13,7 +13,8 @@ import {
|
||||
TImportCaCertificateResponse,
|
||||
TSignIntermediateDTO,
|
||||
TSignIntermediateResponse,
|
||||
TUpdateCaDTO} from "./types";
|
||||
TUpdateCaDTO
|
||||
} from "./types";
|
||||
|
||||
export const useCreateCa = () => {
|
||||
const queryClient = useQueryClient();
|
||||
@@ -21,7 +22,7 @@ export const useCreateCa = () => {
|
||||
mutationFn: async (body) => {
|
||||
const {
|
||||
data: { ca }
|
||||
} = await apiRequest.post<{ ca: TCertificateAuthority }>("/api/v1/ca/", body);
|
||||
} = await apiRequest.post<{ ca: TCertificateAuthority }>("/api/v1/pki/ca/", body);
|
||||
return ca;
|
||||
},
|
||||
onSuccess: (_, { projectSlug }) => {
|
||||
@@ -36,7 +37,7 @@ export const useUpdateCa = () => {
|
||||
mutationFn: async ({ caId, projectSlug, ...body }) => {
|
||||
const {
|
||||
data: { ca }
|
||||
} = await apiRequest.patch<{ ca: TCertificateAuthority }>(`/api/v1/ca/${caId}`, body);
|
||||
} = await apiRequest.patch<{ ca: TCertificateAuthority }>(`/api/v1/pki/ca/${caId}`, body);
|
||||
return ca;
|
||||
},
|
||||
onSuccess: (_, { projectSlug }) => {
|
||||
@@ -51,7 +52,7 @@ export const useDeleteCa = () => {
|
||||
mutationFn: async ({ caId }) => {
|
||||
const {
|
||||
data: { ca }
|
||||
} = await apiRequest.delete<{ ca: TCertificateAuthority }>(`/api/v1/ca/${caId}`);
|
||||
} = await apiRequest.delete<{ ca: TCertificateAuthority }>(`/api/v1/pki/ca/${caId}`);
|
||||
return ca;
|
||||
},
|
||||
onSuccess: (_, { projectSlug }) => {
|
||||
@@ -65,7 +66,7 @@ export const useSignIntermediate = () => {
|
||||
return useMutation<TSignIntermediateResponse, {}, TSignIntermediateDTO>({
|
||||
mutationFn: async (body) => {
|
||||
const { data } = await apiRequest.post<TSignIntermediateResponse>(
|
||||
`/api/v1/ca/${body.caId}/sign-intermediate`,
|
||||
`/api/v1/pki/ca/${body.caId}/sign-intermediate`,
|
||||
body
|
||||
);
|
||||
return data;
|
||||
@@ -78,7 +79,7 @@ export const useImportCaCertificate = () => {
|
||||
return useMutation<TImportCaCertificateResponse, {}, TImportCaCertificateDTO>({
|
||||
mutationFn: async ({ caId, ...body }) => {
|
||||
const { data } = await apiRequest.post<TImportCaCertificateResponse>(
|
||||
`/api/v1/ca/${caId}/import-certificate`,
|
||||
`/api/v1/pki/ca/${caId}/import-certificate`,
|
||||
body
|
||||
);
|
||||
return data;
|
||||
@@ -95,7 +96,7 @@ export const useCreateCertificate = () => {
|
||||
return useMutation<TCreateCertificateResponse, {}, TCreateCertificateDTO>({
|
||||
mutationFn: async ({ caId, ...body }) => {
|
||||
const { data } = await apiRequest.post<TCreateCertificateResponse>(
|
||||
`/api/v1/ca/${caId}/issue-certificate`,
|
||||
`/api/v1/pki/ca/${caId}/issue-certificate`,
|
||||
body
|
||||
);
|
||||
return data;
|
||||
|
||||
@@ -16,7 +16,7 @@ export const useGetCaById = (caId: string) => {
|
||||
queryFn: async () => {
|
||||
const {
|
||||
data: { ca }
|
||||
} = await apiRequest.get<{ ca: TCertificateAuthority }>(`/api/v1/ca/${caId}`);
|
||||
} = await apiRequest.get<{ ca: TCertificateAuthority }>(`/api/v1/pki/ca/${caId}`);
|
||||
return ca;
|
||||
},
|
||||
enabled: Boolean(caId)
|
||||
@@ -31,7 +31,7 @@ export const useGetCaCert = (caId: string) => {
|
||||
certificate: string;
|
||||
certificateChain: string;
|
||||
serialNumber: string;
|
||||
}>(`/api/v1/ca/${caId}/certificate`);
|
||||
}>(`/api/v1/pki/ca/${caId}/certificate`);
|
||||
return data;
|
||||
},
|
||||
enabled: Boolean(caId)
|
||||
@@ -46,7 +46,7 @@ export const useGetCaCsr = (caId: string) => {
|
||||
data: { csr }
|
||||
} = await apiRequest.get<{
|
||||
csr: string;
|
||||
}>(`/api/v1/ca/${caId}/csr`);
|
||||
}>(`/api/v1/pki/ca/${caId}/csr`);
|
||||
return csr;
|
||||
},
|
||||
enabled: Boolean(caId)
|
||||
|
||||
Reference in New Issue
Block a user