56 lines
1.1 KiB
JavaScript
56 lines
1.1 KiB
JavaScript
import { Button } from "@material-ui/core";
|
|
import React from "react";
|
|
|
|
import DownloadFileLink from "../../Controls/DownloadFileLink";
|
|
import useStyles from "../../useStyles";
|
|
|
|
const CertMimeType = "application/x-pem-file";
|
|
|
|
const DownloadCerts = ({
|
|
commonName,
|
|
publicCert,
|
|
privateCert,
|
|
onChangeView,
|
|
}) => {
|
|
const classes = useStyles();
|
|
|
|
const onNewCert = (event) => {
|
|
event.preventDefault();
|
|
if (!onChangeView) return;
|
|
onChangeView();
|
|
};
|
|
return (
|
|
<div>
|
|
<h2>Download Certificates</h2>
|
|
<ul>
|
|
<li>
|
|
<DownloadFileLink
|
|
data={publicCert}
|
|
filename={`${commonName}_cert.pem`}
|
|
mimetype={CertMimeType}
|
|
/>
|
|
</li>
|
|
<li>
|
|
<DownloadFileLink
|
|
data={privateCert}
|
|
filename={`${commonName}_key.pem`}
|
|
mimetype={CertMimeType}
|
|
/>
|
|
</li>
|
|
</ul>
|
|
<Button
|
|
type="submit"
|
|
fullWidth
|
|
variant="contained"
|
|
color="primary"
|
|
className={classes.submit}
|
|
onClick={onNewCert}
|
|
>
|
|
Done
|
|
</Button>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default DownloadCerts;
|