diff --git a/dashboard/src/states/Dashboard/pages/Info/components/Offline/components/Download/Download.jsx b/dashboard/src/states/Dashboard/pages/Info/components/Offline/components/Download/Download.jsx new file mode 100644 index 0000000..2f9e779 --- /dev/null +++ b/dashboard/src/states/Dashboard/pages/Info/components/Offline/components/Download/Download.jsx @@ -0,0 +1,33 @@ +import {Button, Stack, Typography} from "@mui/material"; +import {ProjectContext} from "@/states/Dashboard/contexts/Project"; +import {useContext} from "react"; +import {getRequest} from "@/common/utils/RequestUtil.js"; + +export const Download = () => { + + const {currentProject} = useContext(ProjectContext); + + const download = async () => { + getRequest(`/project/${currentProject.id}/public-key`).then(response => { + const element = document.createElement("a"); + const file = new Blob([response.key], {type: 'text/plain'}); + element.href = URL.createObjectURL(file); + element.download = currentProject.name + "_key.pem"; + document.body.appendChild(element); + element.click(); + }); + } + + return ( + + + Download public key + + Download the public key to use for offline license generation. + + + + + ) +} \ No newline at end of file diff --git a/dashboard/src/states/Dashboard/pages/Info/components/Offline/components/Download/index.js b/dashboard/src/states/Dashboard/pages/Info/components/Offline/components/Download/index.js new file mode 100644 index 0000000..fad6b57 --- /dev/null +++ b/dashboard/src/states/Dashboard/pages/Info/components/Offline/components/Download/index.js @@ -0,0 +1 @@ +export {Download as default} from "./Download.jsx"; \ No newline at end of file