Skip to content

Commit

Permalink
🎨 Use traditional for loop to get arweaveId
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraHuang22 committed Apr 9, 2024
1 parent 79cd883 commit bc8ddb7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions components/IscnUploadForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,9 @@ export default class IscnUploadForm extends Vue {
if (this.epubMetadataList?.find(epubMetadata => epubMetadata.thumbnailArweaveId)) {
return;
}
// eslint-disable-next-line no-restricted-syntax
for (const file of this.fileRecords) {
for (let i = 0; i < this.fileRecords.length; i += 1) {
const file = this.fileRecords[i]
if (IMAGE_MIME_TYPES.includes(file.fileType)) {
const existingData =
this.sentArweaveTransactionInfo.get(file.ipfsHash) || {}
Expand All @@ -848,10 +849,10 @@ export default class IscnUploadForm extends Vue {
})
return
}
let {transactionHash} = existingData;
let { transactionHash } = existingData
if (!transactionHash) {
// eslint-disable-next-line no-await-in-loop
transactionHash = await this.sendArweaveFeeTx(file);
transactionHash = await this.sendArweaveFeeTx(file)
}
// eslint-disable-next-line no-await-in-loop
const arweaveId = await this.uploadFileAndGetArweaveId(
Expand All @@ -864,7 +865,10 @@ export default class IscnUploadForm extends Vue {
thumbnailIpfsHash: file.ipfsHash,
thumbnailArweaveId: arweaveId,
})
this.sentArweaveTransactionInfo.set(file.ipfsHash, { transactionHash, arweaveId });
this.sentArweaveTransactionInfo.set(file.ipfsHash, {
transactionHash,
arweaveId,
})
return
}
return
Expand Down

0 comments on commit bc8ddb7

Please sign in to comment.