Skip to content

Commit

Permalink
style(crypto): removed mixing of promise chaining and async/await
Browse files Browse the repository at this point in the history
  • Loading branch information
seaerchin committed May 27, 2021
1 parent 0eedc38 commit 9cce879
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,13 @@ export default class Crypto {
responseType: 'json',
})
// Decrypt all the attachments
.then(async ({ data: downloadResponse }) => {
.then(({ data: downloadResponse }) => {
const encryptedFile =
convertEncryptedAttachmentToFileContent(downloadResponse)

const decryptedFile = await this.decryptFile(
formSecretKey,
encryptedFile
)

// If there is content, extract and put
return this.decryptFile(formSecretKey, encryptedFile)
})
.then((decryptedFile) => {
// Check if the file exists and set the filename accordingly; otherwise, throw an error
if (decryptedFile) {
decryptedRecords[fieldId] = {
filename: filenames[fieldId],
Expand Down

0 comments on commit 9cce879

Please sign in to comment.