web/satellite: billing history refreshing bug fix

Change-Id: I221e2dc13179b9368dea1c7e1a46b8b49b79c729
This commit is contained in:
VitaliiShpital 2020-02-10 18:56:43 +02:00
parent 68d5b1d6ec
commit a90955eced
2 changed files with 22 additions and 9 deletions

View File

@ -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<void> {
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;
}

View File

@ -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();