mirror of
https://github.com/beestat/app.git
synced 2025-05-24 02:14:03 -04:00
Fixed #400 - Clicking "Continue to Payment" can result in runaway API calls
This commit is contained in:
parent
212a8e26db
commit
91f3110584
@ -280,26 +280,35 @@ beestat.component.card.contribute.prototype.decorate_contents_ = function(parent
|
|||||||
parent.appendChild($(button_container));
|
parent.appendChild($(button_container));
|
||||||
|
|
||||||
const continue_tile = new beestat.component.tile()
|
const continue_tile = new beestat.component.tile()
|
||||||
.set_background_color(beestat.style.color.green.base)
|
|
||||||
.set_background_hover_color(beestat.style.color.green.light)
|
|
||||||
.set_text_color('#fff')
|
|
||||||
.set_size('large')
|
.set_size('large')
|
||||||
.set_icon('credit_card_lock')
|
.set_icon('credit_card_lock')
|
||||||
.set_text('Continue to Payment');
|
.set_text('Continue to Payment');
|
||||||
continue_tile.addEventListener('click', function() {
|
|
||||||
self.state_.stripe_connecting = true;
|
|
||||||
|
|
||||||
this
|
if (this.state_.stripe_connecting === true) {
|
||||||
|
continue_tile
|
||||||
.set_background_color(beestat.style.color.gray.base)
|
.set_background_color(beestat.style.color.gray.base)
|
||||||
.set_background_hover_color()
|
.set_background_hover_color();
|
||||||
.removeEventListener('click');
|
} else {
|
||||||
|
continue_tile
|
||||||
|
.set_background_color(beestat.style.color.green.base)
|
||||||
|
.set_background_hover_color(beestat.style.color.green.light)
|
||||||
|
.set_text_color('#fff');
|
||||||
|
|
||||||
window.open('api/?resource=stripe_payment_link&method=open&arguments={"attributes":{"amount":' + (contribute_amount * 100) + ',"currency":"' + beestat.setting('units.currency') + '","interval":"' + contribute_interval + '"}}&api_key=' + window.beestat_api_key_local);
|
continue_tile.addEventListener('click', function() {
|
||||||
|
self.state_.stripe_connecting = true;
|
||||||
|
|
||||||
setTimeout(function() {
|
this
|
||||||
self.rerender();
|
.set_background_color(beestat.style.color.gray.base)
|
||||||
}, 5000);
|
.set_background_hover_color()
|
||||||
});
|
.removeEventListener('click');
|
||||||
|
|
||||||
|
window.open('api/?resource=stripe_payment_link&method=open&arguments={"attributes":{"amount":' + (contribute_amount * 100) + ',"currency":"' + beestat.setting('units.currency') + '","interval":"' + contribute_interval + '"}}&api_key=' + window.beestat_api_key_local);
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
self.rerender();
|
||||||
|
}, 5000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
continue_tile.render($(button_container));
|
continue_tile.render($(button_container));
|
||||||
|
|
||||||
@ -312,7 +321,6 @@ beestat.component.card.contribute.prototype.decorate_contents_ = function(parent
|
|||||||
|
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
api_call.send();
|
api_call.send();
|
||||||
self.rerender();
|
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user