mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 07:26:34 +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"
|
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"
|
openapi: "GET /api/v2/workspace/{slug}/private-key"
|
||||||
---
|
---
|
||||||
|
|||||||
+17
-9
@@ -1,14 +1,14 @@
|
|||||||
import { Modal, ModalContent } from "@app/components/v2";
|
import { Modal, ModalContent } from "@app/components/v2";
|
||||||
import { useGetCertBody } from "@app/hooks/api";
|
|
||||||
import { UsePopUpState } from "@app/hooks/usePopUp";
|
|
||||||
|
|
||||||
import { CertificateContent } from "./CertificateContent";
|
|
||||||
import {
|
import {
|
||||||
ProjectPermissionCertificateActions,
|
ProjectPermissionCertificateActions,
|
||||||
ProjectPermissionSub,
|
ProjectPermissionSub,
|
||||||
useProjectPermission
|
useProjectPermission
|
||||||
} from "@app/context";
|
} from "@app/context";
|
||||||
|
import { useGetCertBody } from "@app/hooks/api";
|
||||||
import { useGetCertBundle } from "@app/hooks/api/certificates/queries";
|
import { useGetCertBundle } from "@app/hooks/api/certificates/queries";
|
||||||
|
import { UsePopUpState } from "@app/hooks/usePopUp";
|
||||||
|
|
||||||
|
import { CertificateContent } from "./CertificateContent";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
popUp: UsePopUpState<["certificateCert"]>;
|
popUp: UsePopUpState<["certificateCert"]>;
|
||||||
@@ -26,9 +26,18 @@ export const CertificateCertModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
ProjectPermissionSub.Certificates
|
ProjectPermissionSub.Certificates
|
||||||
);
|
);
|
||||||
|
|
||||||
const { data } = canReadPrivateKey
|
// useGetCertBundle fails unless user has the correct permissions
|
||||||
? useGetCertBundle(serialNumber)
|
const { data: bundleData } = useGetCertBundle(serialNumber);
|
||||||
: useGetCertBody(serialNumber);
|
const { data: bodyData } = useGetCertBody(serialNumber);
|
||||||
|
|
||||||
|
const data:
|
||||||
|
| {
|
||||||
|
certificate: string;
|
||||||
|
certificateChain: string;
|
||||||
|
serialNumber: string;
|
||||||
|
privateKey?: string;
|
||||||
|
}
|
||||||
|
| undefined = canReadPrivateKey ? bundleData : bodyData;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
@@ -43,8 +52,7 @@ export const CertificateCertModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
serialNumber={data.serialNumber}
|
serialNumber={data.serialNumber}
|
||||||
certificate={data.certificate}
|
certificate={data.certificate}
|
||||||
certificateChain={data.certificateChain}
|
certificateChain={data.certificateChain}
|
||||||
// A hacky fix for typescript error
|
privateKey={data.privateKey}
|
||||||
privateKey={(data as { privateKey?: string }).privateKey}
|
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div />
|
<div />
|
||||||
|
|||||||
Reference in New Issue
Block a user