From a90955eced250ee21ec82f8be913221fa66a2b5b Mon Sep 17 00:00:00 2001 From: VitaliiShpital Date: Mon, 10 Feb 2020 18:56:43 +0200 Subject: [PATCH] web/satellite: billing history refreshing bug fix Change-Id: I221e2dc13179b9368dea1c7e1a46b8b49b79c729 --- .../billing/paymentMethods/PaymentMethods.vue | 16 +++++++++++----- .../src/components/project/NewProjectPopup.vue | 15 +++++++++++---- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/web/satellite/src/components/account/billing/paymentMethods/PaymentMethods.vue b/web/satellite/src/components/account/billing/paymentMethods/PaymentMethods.vue index de8a05514..14785b10f 100644 --- a/web/satellite/src/components/account/billing/paymentMethods/PaymentMethods.vue +++ b/web/satellite/src/components/account/billing/paymentMethods/PaymentMethods.vue @@ -84,7 +84,6 @@ import VButton from '@/components/common/VButton.vue'; import { PAYMENTS_ACTIONS } from '@/store/modules/payments'; import { CreditCard } from '@/types/payments'; -import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames'; import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; import { PaymentMethodsBlockState } from '@/utils/constants/billingEnums'; @@ -122,7 +121,7 @@ export default class PaymentMethods extends Vue { }); this.$store.dispatch(GET_CREDIT_CARDS); } catch (error) { - this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, error.message); + this.$notify.error(error.message); } } @@ -213,6 +212,13 @@ export default class PaymentMethods extends Vue { public async onConfirmAddStripe(): Promise { await this.$refs.stripeCardInput.onSubmit(); + + try { + await this.$store.dispatch(GET_BILLING_HISTORY); + } catch (error) { + await this.$notify.error(error.message); + } + this.$segment.track(SegmentEvent.PAYMENT_METHOD_ADDED, { project_id: this.$store.getters.selectedProject.id, }); @@ -228,21 +234,21 @@ export default class PaymentMethods extends Vue { try { await this.$store.dispatch(ADD_CREDIT_CARD, token); } catch (error) { - await this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, error.message); + await this.$notify.error(error.message); this.isLoading = false; return; } - await this.$store.dispatch(NOTIFICATION_ACTIONS.SUCCESS, 'Card successfully added'); + await this.$notify.success('Card successfully added'); this.$segment.track(SegmentEvent.PAYMENT_METHOD_ADDED, { project_id: this.$store.getters.selectedProject.id, }); try { await this.$store.dispatch(GET_CREDIT_CARDS); } catch (error) { - await this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, error.message); + await this.$notify.error(error.message); this.isLoading = false; } diff --git a/web/satellite/src/components/project/NewProjectPopup.vue b/web/satellite/src/components/project/NewProjectPopup.vue index 0d0342476..73da1ff6d 100644 --- a/web/satellite/src/components/project/NewProjectPopup.vue +++ b/web/satellite/src/components/project/NewProjectPopup.vue @@ -61,6 +61,7 @@ import VButton from '@/components/common/VButton.vue'; import CloseCrossIcon from '@/../static/images/common/closeCross.svg'; import { BUCKET_ACTIONS } from '@/store/modules/buckets'; +import { PAYMENTS_ACTIONS } from '@/store/modules/payments'; import { PROJECTS_ACTIONS } from '@/store/modules/projects'; import { PROJECT_USAGE_ACTIONS } from '@/store/modules/usage'; import { CreateProjectModel, Project } from '@/types/projects'; @@ -117,9 +118,9 @@ export default class NewProjectPopup extends Vue { this.$segment.track(SegmentEvent.PROJECT_CREATED, { project_id: this.createdProjectId, }); - } catch (e) { + } catch (error) { this.isLoading = false; - await this.$notify.error(e.message); + await this.$notify.error(error.message); this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_NEW_PROJ); return; @@ -129,8 +130,14 @@ export default class NewProjectPopup extends Vue { try { await this.fetchProjectMembers(); - } catch (e) { - await this.$notify.error(e.message); + } catch (error) { + await this.$notify.error(error.message); + } + + try { + await this.$store.dispatch(PAYMENTS_ACTIONS.GET_BILLING_HISTORY); + } catch (error) { + await this.$notify.error(error.message); } this.clearApiKeys();