Skip to content

Commit

Permalink
Merge pull request kodadot#3554 from Jarsen136/issue-3547
Browse files Browse the repository at this point in the history
Retry on the minting in case of errors
  • Loading branch information
kkukelka committed Jul 27, 2022
2 parents 78bbc10 + b24fdab commit 4bcae2b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions components/bsx/Create/CreateToken.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
label="mint.submit"
:disabled="disabled"
:loading="isLoading"
@click="submit" />
@click="submit()" />
</template>
</BaseTokenForm>
</div>
Expand Down Expand Up @@ -261,7 +261,7 @@ export default class CreateToken extends mixins(
return !this.listed || (price > 0 && price <= this.maxPrice)
}
protected async submit(): Promise<void> {
protected async submit(retryCount = 0): Promise<void> {
if (!this.base.selectedCollection) {
throw ReferenceError('[MINT] Unable to mint without collection')
}
Expand Down Expand Up @@ -311,8 +311,16 @@ export default class CreateToken extends mixins(
})
} catch (e) {
if (e instanceof Error) {
showNotification(e.toString(), notificationTypes.danger)
this.stopLoader()
if (retryCount < 3) {
// retry
showNotification('Retrying to complete minting process.')
this.submit(retryCount + 1)
} else {
// finally fail
showNotification(e.toString(), notificationTypes.danger)
}
}
}
}
Expand Down

1 comment on commit 4bcae2b

@vercel
Copy link

@vercel vercel bot commented on 4bcae2b Jul 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nft-gallery – ./

nft-gallery-git-main-preschian.vercel.app
nft-gallery-ruddy.vercel.app
nft-gallery-preschian.vercel.app

Please sign in to comment.