Fixed disabling button and dismissing modals (#9805)

This commit is contained in:
Keith Holliday
2018-01-15 09:16:15 -07:00
committed by GitHub
parent c33eba6736
commit d4f634c3d8

View File

@@ -7,8 +7,8 @@
style="width: 400px; height: 140px;")
.modal-footer
.text-center
.btn.btn-primary(v-if="amazonPaymentsCanCheckout",
@click="amazonCheckOut()") {{ $t('checkout') }}
button.btn.btn-primary(v-if="amazonPaymentsCanCheckout",
@click="amazonCheckOut()", :disabled='!amazonButtonEnabled') {{ $t('checkout') }}
</template>
<style scoped>
@@ -164,6 +164,7 @@ export default {
onReady: (consent) => {
let getConsent = consent.getConsentStatus;
this.$set(this.amazonPayments, 'recurringConsent', getConsent ? Boolean(getConsent()) : false);
this.$set(this, 'amazonButtonEnabled', true);
},
onConsent: (consent) => {
this.$set(this.amazonPayments, 'recurringConsent', Boolean(consent.getConsentStatus()));
@@ -190,6 +191,7 @@ export default {
});
if (response.status < 400) {
this.$set(this, 'amazonButtonEnabled', true);
this.reset();
// @TODO: What are we syncing?
window.location.reload(true);
@@ -216,11 +218,14 @@ export default {
let responseStatus = response.status;
if (responseStatus >= 400) {
this.$set(this, 'amazonButtonEnabled', true);
alert(`Error: ${response.message}`);
// @TODO: do we need this? this.amazonPaymentsreset();
return;
}
this.$root.$emit('bv::hide::modal', 'amazon-payment');
let newGroup = response.data.data;
if (newGroup && newGroup._id) {
// @TODO: Just append? or $emit?