From bc8ddb71d0c95fc978de84c76fa735d04663cd5d Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Tue, 9 Apr 2024 13:14:40 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Use=20traditional=20for=20loop?= =?UTF-8?q?=20to=20get=20arweaveId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/IscnUploadForm.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/components/IscnUploadForm.vue b/components/IscnUploadForm.vue index 5f211519..44d8fd68 100644 --- a/components/IscnUploadForm.vue +++ b/components/IscnUploadForm.vue @@ -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) || {} @@ -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( @@ -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