Skip to content

Commit d995672

Browse files
committed
fix: refresh payment methods after user adds a payment method
If methods doesn't include the paymentMethodId, the Payment method input will show "No saved payment methods". Since paymentMethodId gets set after a user adds their payment method, we can listen for when it's set and fetch the methods if the newly added payment method isn't in the original list of payment methods.
1 parent b380583 commit d995672

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/routes/(console)/apply-credit/+page.svelte

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,14 @@
255255
})();
256256
}
257257
}
258+
259+
// after adding a payment method, fetch the payment methods again so the input can be updated
260+
$: if (
261+
paymentMethodId &&
262+
!methods?.paymentMethods?.find((method) => method.$id === paymentMethodId)
263+
) {
264+
loadPaymentMethods();
265+
}
258266
</script>
259267

260268
<svelte:head>

0 commit comments

Comments
 (0)