mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
review fixes: docs + frontend
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "List"
|
||||
title: "Get Certificate Bundle"
|
||||
openapi: "GET /api/v2/workspace/{slug}/bundle"
|
||||
---
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "List"
|
||||
title: "Get Certificate Private Key"
|
||||
openapi: "GET /api/v2/workspace/{slug}/private-key"
|
||||
---
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Modal, ModalContent } from "@app/components/v2";
|
||||
import { useGetCertBody } from "@app/hooks/api";
|
||||
import { UsePopUpState } from "@app/hooks/usePopUp";
|
||||
|
||||
import { CertificateContent } from "./CertificateContent";
|
||||
import {
|
||||
ProjectPermissionCertificateActions,
|
||||
ProjectPermissionSub,
|
||||
useProjectPermission
|
||||
} from "@app/context";
|
||||
import { useGetCertBody } from "@app/hooks/api";
|
||||
import { useGetCertBundle } from "@app/hooks/api/certificates/queries";
|
||||
import { UsePopUpState } from "@app/hooks/usePopUp";
|
||||
|
||||
import { CertificateContent } from "./CertificateContent";
|
||||
|
||||
type Props = {
|
||||
popUp: UsePopUpState<["certificateCert"]>;
|
||||
@@ -26,9 +26,18 @@ export const CertificateCertModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
ProjectPermissionSub.Certificates
|
||||
);
|
||||
|
||||
const { data } = canReadPrivateKey
|
||||
? useGetCertBundle(serialNumber)
|
||||
: useGetCertBody(serialNumber);
|
||||
// useGetCertBundle fails unless user has the correct permissions
|
||||
const { data: bundleData } = useGetCertBundle(serialNumber);
|
||||
const { data: bodyData } = useGetCertBody(serialNumber);
|
||||
|
||||
const data:
|
||||
| {
|
||||
certificate: string;
|
||||
certificateChain: string;
|
||||
serialNumber: string;
|
||||
privateKey?: string;
|
||||
}
|
||||
| undefined = canReadPrivateKey ? bundleData : bodyData;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
@@ -43,8 +52,7 @@ export const CertificateCertModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
serialNumber={data.serialNumber}
|
||||
certificate={data.certificate}
|
||||
certificateChain={data.certificateChain}
|
||||
// A hacky fix for typescript error
|
||||
privateKey={(data as { privateKey?: string }).privateKey}
|
||||
privateKey={data.privateKey}
|
||||
/>
|
||||
) : (
|
||||
<div />
|
||||
|
||||
Reference in New Issue
Block a user