Make 2nd file download async to fix (#9711)

# Addresses #9680 
- Add 100ms timeout before 2nd key is downloaded from browser
- Fix file decoding to correctly download both keys
- Fix copy

# Checklist for submitter

- [x] Manual QA for all new/changed functionality

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
Co-authored-by: Roberto Dip <roberto@fleetdm.com>
This commit is contained in:
Jacob Shandling 2023-02-09 14:50:20 -08:00 committed by GitHub
parent c2d557588d
commit 429edde09f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -105,7 +105,7 @@ const Mdm = (): JSX.Element => {
const privateFilename = "fleet-apple-mdm-bm-private.key";
const privateFile = new global.window.File(
[keys.decodedPublic],
[keys.decodedPrivate],
privateFilename,
{
type: "application/x-pem-file",
@ -113,7 +113,9 @@ const Mdm = (): JSX.Element => {
);
FileSaver.saveAs(publicFile);
FileSaver.saveAs(privateFile);
setTimeout(() => {
FileSaver.saveAs(privateFile);
}, 100);
} else {
renderFlash(
"error",