Remove cancel button when clicked (#9616)

This commit is contained in:
Keith Holliday
2017-12-01 08:03:54 -06:00
committed by GitHub
parent 3c7aaa605b
commit 78ee60611a
2 changed files with 7 additions and 1 deletions

View File

@@ -68,7 +68,7 @@
div(v-if='hasSubscription')
.btn.btn-primary(v-if='canEditCardDetails', @click='showStripeEdit()') {{ $t('subUpdateCard') }}
.btn.btn-sm.btn-danger(v-if='canCancelSubscription', @click='cancelSubscription()') {{ $t('cancelSub') }}
.btn.btn-sm.btn-danger(v-if='canCancelSubscription && !loading', @click='cancelSubscription()') {{ $t('cancelSub') }}
small(v-if='!canCancelSubscription', v-html='getCancelSubInfo()')
.subscribe-pay(v-if='!hasSubscription || hasCanceledSubscription')
@@ -118,6 +118,7 @@ export default {
mixins: [paymentsMixin],
data () {
return {
loading: false,
gemCostTranslation: {
gemCost: planGemLimits.convRate,
gemLimit: planGemLimits.convRate,

View File

@@ -175,6 +175,8 @@ export default {
if (config && config.group && !confirm(this.$t('confirmCancelGroupPlan'))) return;
if (!confirm(this.$t('sureCancelSub'))) return;
this.loading = true;
let group;
if (config && config.group) {
group = config.group;
@@ -203,6 +205,9 @@ export default {
let cancelUrl = `/${paymentMethod}/subscribe/cancel?${encodeParams(queryParams)}`;
await axios.get(cancelUrl);
this.loading = false;
// Success
alert(this.$t('paypalCanceled'));
this.$router.push('/');