Skip to content

Commit

Permalink
Add in watch to handle case where not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
seeker25 committed Jan 16, 2025
1 parent 108b92f commit 8454b05
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions auth-web/src/components/auth/common/PaymentMethods.vue
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,6 @@ export default defineComponent({
if (currentSelectedProducts.value.length === 0) {
paymentMethod.supported = false
}
if (paymentType === state.selectedPaymentMethod && !paymentMethod.supported) {
// TODO fix side effect
state.selectedPaymentMethod = ''
emit('payment-method-selected', state.selectedPaymentMethod)
}
}
paymentMethods.push(paymentMethod)
}
Expand Down Expand Up @@ -528,6 +523,16 @@ export default defineComponent({
state.selectedPaymentMethod = newValue
})
watch(() => [state.paymentMethodSupportedForProducts, state.filteredPaymentMethods], () => {
if (props.isCreateAccount && state.selectedPaymentMethod) {
const paymentMethod = PAYMENT_METHODS[state.selectedPaymentMethod]
if (!paymentMethod?.supported) {
state.selectedPaymentMethod = ''
emit('payment-method-selected', state.selectedPaymentMethod)
}
}
})
onMounted(async () => {
paymentMethodSelected({ type: props.currentSelectedPaymentMethod }, false)
if (state.isPaymentEJV) {
Expand Down

0 comments on commit 8454b05

Please sign in to comment.