From e3c74aa15d6adc2d56ee9519ef5fd8ddeb381965 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Tue, 19 Mar 2024 10:32:29 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20the=20missing=20txHash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/IscnUploadForm.vue | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/components/IscnUploadForm.vue b/components/IscnUploadForm.vue index 8040809b..d70f72b7 100644 --- a/components/IscnUploadForm.vue +++ b/components/IscnUploadForm.vue @@ -765,8 +765,6 @@ export default class IscnUploadForm extends Vue { // TODO: Handle error // eslint-disable-next-line no-console console.error(err); - } finally { - this.uploadStatus = ''; } return ''; } @@ -866,16 +864,19 @@ export default class IscnUploadForm extends Vue { if (IMAGE_MIME_TYPES.includes(file.fileType)) { const existingData = this.sentArweaveTransactionInfo.get(file.ipfsHash) || {} - const { transactionHash, arweaveId: uploadArweaveId } = existingData - if (uploadArweaveId) { - this.addToEpubMetadataList(transactionHash as string, uploadArweaveId) + if (existingData.arweaveId) { + this.addToEpubMetadataList(file.ipfsHash, existingData.arweaveId) return } + const transactionHash = + // eslint-disable-next-line no-await-in-loop + existingData.transactionHash || (await this.sendArweaveFeeTx(file)) // eslint-disable-next-line no-await-in-loop const arweaveId = await this.uploadFileAndGetArweaveId( file, - transactionHash as string, + transactionHash, ) + if (arweaveId) { this.addToEpubMetadataList(file.ipfsHash, arweaveId) return @@ -887,9 +888,6 @@ export default class IscnUploadForm extends Vue { async onSubmit() { if (IS_CHAIN_UPGRADING) return - if (this.checkUploadFileTypeIsPDF()) { - await this.setEbookCoverFromImages() - } logTrackerEvent(this, 'ISCNCreate', 'ClickUpload', '', 1); this.uploadStatus = 'uploading' this.error = '' @@ -912,6 +910,11 @@ export default class IscnUploadForm extends Vue { try { this.uploadStatus = 'uploading'; + + if (this.checkUploadFileTypeIsPDF()) { + await this.setEbookCoverFromImages() + } + // eslint-disable-next-line no-restricted-syntax this.numberOfSignNeeded = this.modifiedFileRecords.length; this.signProgress = 0;