From 0c77c0dcbd0f507cc1776340dc21f17aaa722a25 Mon Sep 17 00:00:00 2001 From: William Chong Date: Wed, 27 Nov 2024 15:00:06 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20missing=20wnft=20status=20?= =?UTF-8?q?in=20claim=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/nft/claim/index.vue | 73 ++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/src/pages/nft/claim/index.vue b/src/pages/nft/claim/index.vue index 84652da10..9a4d3c7d6 100644 --- a/src/pages/nft/claim/index.vue +++ b/src/pages/nft/claim/index.vue @@ -578,6 +578,7 @@ import { import { postStripeFiatPendingClaim, getNFTBookClaimEndpoint, + getStripeFiatPaymentStatus, getNFTBookPaymentStatusEndpoint, getFreeNFTBookPurchaseEndpoint, getNFTBookCartStatusEndpoint, @@ -802,6 +803,7 @@ export default { !newValue && !( this.status === 'completed' || + this.status === 'done' || this.status === 'pending' || this.status === 'pendingNFT' ) @@ -854,33 +856,49 @@ export default { this.giftInfo = giftInfo; if (query.type === 'nft_book') this.clearBookProductShoppingCart(); } else if (this.paymentId) { - try { - const { data } = await this.$api.get( - getNFTBookPaymentStatusEndpoint({ - classId: this.classId, - collectionId: this.collectionId, - paymentId: this.paymentId, - token: this.token, - }) - ); - ({ price, priceIndex } = data); - const { - giftInfo, - isPhysicalOnly, - status, - autoMemo, - isAutoDeliver, - quantity, - } = data; - this.giftInfo = giftInfo; - this.isPhysicalOnly = isPhysicalOnly; - this.isAutoDeliver = isAutoDeliver; - this.creatorMessage = parseAutoMemo(autoMemo); - this.status = status; - this.quantity = quantity; - } catch (err) { - // eslint-disable-next-line no-console - console.error(err); + if (this.isNFTBook) { + try { + const { data } = await this.$api.get( + getNFTBookPaymentStatusEndpoint({ + classId: this.classId, + collectionId: this.collectionId, + paymentId: this.paymentId, + token: this.token, + }) + ); + ({ price, priceIndex } = data); + const { + giftInfo, + isPhysicalOnly, + status, + autoMemo, + isAutoDeliver, + quantity, + } = data; + this.giftInfo = giftInfo; + this.isPhysicalOnly = isPhysicalOnly; + this.isAutoDeliver = isAutoDeliver; + this.creatorMessage = parseAutoMemo(autoMemo); + this.status = status; + this.quantity = quantity; + } catch (err) { + // eslint-disable-next-line no-console + console.error(err); + } + } else { + try { + const { data } = await this.$api.get( + getStripeFiatPaymentStatus({ + paymentId: this.paymentId, + token: this.token, + }) + ); + this.status = data.status; + price = data.fiatPrice; + } catch (err) { + // eslint-disable-next-line no-console + console.error(err); + } } } else { // free purchase? @@ -1004,6 +1022,7 @@ export default { if ( this.status === 'completed' || + this.status === 'done' || this.status === 'pending' || this.status === 'pendingNFT' ) {