From f5d7777b2c2a8d27c2bf6bee09e74d91e0168aa2 Mon Sep 17 00:00:00 2001 From: Keith Holliday Date: Tue, 23 Jan 2018 10:28:44 -0700 Subject: [PATCH] Reloaded user data after cancelling subscription (#9836) --- website/client/mixins/payments.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/website/client/mixins/payments.js b/website/client/mixins/payments.js index 07930f8c52..40948eeddb 100644 --- a/website/client/mixins/payments.js +++ b/website/client/mixins/payments.js @@ -203,14 +203,18 @@ export default { queryParams.groupId = group._id; } - let cancelUrl = `/${paymentMethod}/subscribe/cancel?${encodeParams(queryParams)}`; - await axios.get(cancelUrl); + try { + const cancelUrl = `/${paymentMethod}/subscribe/cancel?${encodeParams(queryParams)}`; + await axios.get(cancelUrl); - this.loading = false; + alert(this.$t('paypalCanceled')); + // @TODO: We should probably update the api to return the new sub data eventually. + await this.$store.dispatch('user:fetch', {forceLoad: true}); - // Success - alert(this.$t('paypalCanceled')); - this.$router.push('/'); + this.loading = false; + } catch (e) { + alert(e.response.data.message); + } }, }, };