Only allow to resubmit a tip when a previous has completed or failed (#429)
This commit is contained in:
parent
08ebedb4cc
commit
62122f6a96
1 changed files with 6 additions and 3 deletions
|
@ -246,7 +246,9 @@ export function CommentCreate(props: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function doSubmitTip() {
|
function doSubmitTip() {
|
||||||
if (!activeChannelClaim) return;
|
if (!activeChannelClaim || isSubmitting) return;
|
||||||
|
|
||||||
|
setSubmitting(true);
|
||||||
|
|
||||||
const params = { amount: tipAmount, claim_id: claimId, channel_id: activeChannelClaim.claim_id };
|
const params = { amount: tipAmount, claim_id: claimId, channel_id: activeChannelClaim.claim_id };
|
||||||
const activeChannelName = activeChannelClaim && activeChannelClaim.name;
|
const activeChannelName = activeChannelClaim && activeChannelClaim.name;
|
||||||
|
@ -256,8 +258,6 @@ export function CommentCreate(props: Props) {
|
||||||
const channelClaimId = claim.signing_channel ? claim.signing_channel.claim_id : claim.claim_id;
|
const channelClaimId = claim.signing_channel ? claim.signing_channel.claim_id : claim.claim_id;
|
||||||
const tipChannelName = claim.signing_channel ? claim.signing_channel.name : claim.name;
|
const tipChannelName = claim.signing_channel ? claim.signing_channel.name : claim.name;
|
||||||
|
|
||||||
setSubmitting(true);
|
|
||||||
|
|
||||||
if (activeTab === TAB_LBC) {
|
if (activeTab === TAB_LBC) {
|
||||||
// call sendTip and then run the callback from the response
|
// call sendTip and then run the callback from the response
|
||||||
// second parameter is callback
|
// second parameter is callback
|
||||||
|
@ -309,8 +309,11 @@ export function CommentCreate(props: Props) {
|
||||||
* @param {string} [environment] Optional environment for Stripe (test|live)
|
* @param {string} [environment] Optional environment for Stripe (test|live)
|
||||||
*/
|
*/
|
||||||
function handleCreateComment(txid, payment_intent_id, environment) {
|
function handleCreateComment(txid, payment_intent_id, environment) {
|
||||||
|
if (isSubmitting) return;
|
||||||
|
|
||||||
setShowEmotes(false);
|
setShowEmotes(false);
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
|
|
||||||
const stickerValue = selectedSticker && buildValidSticker(selectedSticker.name);
|
const stickerValue = selectedSticker && buildValidSticker(selectedSticker.name);
|
||||||
|
|
||||||
createComment(stickerValue || commentValue, claimId, parentId, txid, payment_intent_id, environment, !!stickerValue)
|
createComment(stickerValue || commentValue, claimId, parentId, txid, payment_intent_id, environment, !!stickerValue)
|
||||||
|
|
Loading…
Reference in a new issue