From df13434e16e9ce6a076ba67b7c0e2b4aa3cfdbc9 Mon Sep 17 00:00:00 2001 From: Joshua Kiwiet-Pantaleoni Date: Tue, 21 Nov 2023 13:38:40 -0800 Subject: [PATCH] feat(KvPaymentSelect): emit error instead of using broken local toast --- @kiva/kv-shop/src/components/KvPaymentSelect.vue | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/@kiva/kv-shop/src/components/KvPaymentSelect.vue b/@kiva/kv-shop/src/components/KvPaymentSelect.vue index 33aa03d9..b0ed5a54 100644 --- a/@kiva/kv-shop/src/components/KvPaymentSelect.vue +++ b/@kiva/kv-shop/src/components/KvPaymentSelect.vue @@ -9,7 +9,6 @@ v-if="updatingPaymentWrapper" class="tw-mb-2" /> - @@ -18,7 +17,6 @@ import { defineComponent, onMounted, ref, toRefs, watch, } from 'vue-demi'; import KvLoadingSpinner from '@kiva/kv-components/vue/KvLoadingSpinner.vue'; -import KvToast from '@kiva/kv-components/vue/KvToast.vue'; import type { PropType } from 'vue-demi'; import useBraintreeDropIn, { defaultPaymentTypes } from '../useBraintreeDropIn'; import type { PayPalFlowType, PaymentType } from '../useBraintreeDropIn'; @@ -26,7 +24,6 @@ import type { PayPalFlowType, PaymentType } from '../useBraintreeDropIn'; export default defineComponent({ components: { KvLoadingSpinner, - KvToast, }, props: { amount: { @@ -82,7 +79,7 @@ export default defineComponent({ default: true, }, }, - emits: ['transactions-enabled'], + emits: ['transactions-enabled', 'error'], setup(props, { emit }) { const { amount, @@ -101,11 +98,6 @@ export default defineComponent({ updateAmount, } = useBraintreeDropIn(props.dropInName); - const errorToast = ref(); - const showError = (message: string) => { - errorToast.value?.show(message, 'error', true); - }; - watch(amount, (newValue) => { updateAmount(newValue); }); @@ -130,9 +122,9 @@ export default defineComponent({ }); } catch (e) { if (e instanceof Error) { - showError(e?.message); + emit('error', e?.message); } else { - showError('An Error has occured. Please refresh the page and try again.'); + emit('error', 'An error has occured. Please refresh the page and try again.'); } } finally { updatingPaymentWrapper.value = false;