Skip to content

Commit

Permalink
fix: not redirecting after simple nft minting
Browse files Browse the repository at this point in the history
  • Loading branch information
hassnian committed Aug 6, 2023
1 parent a3aec76 commit 907801f
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions components/rmrk/Create/CreateToken.vue
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,18 @@ export default class CreateToken extends mixins(
}
watch([blockNumber, createdNFTs], () => {
if (this.hasPrice) {
if (blockNumber.value && createdNFTs.value) {
if (blockNumber.value && createdNFTs.value) {
const isJustNftMint = !this.listed
if (isJustNftMint) {
setTimeout(
() =>
this.handleCreatedNftsRedirect(
createdNFTs.value,
blockNumber.value as string
),
300
)
} else if (this.hasPrice) {
setTimeout(
() =>
this.listForSale(
Expand Down Expand Up @@ -319,7 +329,6 @@ export default class CreateToken extends mixins(
nftId: toNFTId(nft, originalBlockNumber),
}))
const isSingle = list.length === 1
this.isLoading = true
transaction({
interaction: Interaction.LIST,
Expand All @@ -332,20 +341,29 @@ export default class CreateToken extends mixins(
watch([isLoading, blockNumber], () => {
if (!isLoading.value && blockNumber.value) {
this.navigateToDetail({
pageId: isSingle
? list[0].nftId
: (this.base.selectedCollection?.id as string),
nftName: this.base.name,
toCollectionPage: !isSingle,
})
this.handleCreatedNftsRedirect(createdNFT, originalBlockNumber)
}
})
} catch (e) {
showNotification((e as Error).message, notificationTypes.warn)
}
}
protected handleCreatedNftsRedirect(
createdNFT: CreatedNFT[] | CreatedNFTV2[],
originalBlockNumber: string
) {
const nfts = createdNFT.map((nft) => toNFTId(nft, originalBlockNumber))
const isSingle = nfts.length === 1
this.navigateToDetail({
pageId: isSingle ? nfts[0] : (this.base.selectedCollection?.id as string),
nftName: this.base.name,
toCollectionPage: !isSingle,
})
}
protected async estimateTx() {
// TODO: implement
}
Expand Down

0 comments on commit 907801f

Please sign in to comment.