fix: payment modal not closing.

This commit is contained in:
Darshan
2025-04-13 11:47:09 +05:30
parent b9e2602bab
commit 4d1cccd329
4 changed files with 13 additions and 7 deletions
@@ -19,9 +19,9 @@
async function handleSubmit() {
try {
const card = await submitStripeCard(name, page?.params?.organization ?? null);
show = false;
invalidate(Dependencies.PAYMENT_METHODS);
dispatch('submit', card);
show = false;
addNotification({
type: 'success',
message: 'A new payment method has been added to your account'
+1 -1
View File
@@ -45,7 +45,7 @@
}
}
$: if (backdrop) {
$: if (backdrop && show && !document.body.contains(backdrop)) {
document.body.appendChild(backdrop);
}
+1 -1
View File
@@ -62,7 +62,7 @@ export async function submitStripeCard(name: string, organizationId?: string) {
}
// Element needs to be submitted before confirming the setup intent
elements.submit();
await elements.submit();
const baseUrl = 'https://cloud.appwrite.io/console';
const accountUrl = `${baseUrl}/account/payments?clientSecret=${clientSecret}`;
@@ -230,7 +230,7 @@
</Typography.Text>
</Tooltip>
</Layout.Stack>
<ActionMenu.Root slot="tooltip">
<ActionMenu.Root slot="tooltip" let:toggle>
{#if $paymentMethods.total}
{#each filteredPaymentMethods as paymentMethod}
<ActionMenu.Item.Button
@@ -245,7 +245,10 @@
<Divider />
<ActionMenu.Item.Button
leadingIcon={IconPlus}
on:click={() => (showPayment = true)}>
on:click={(e) => {
toggle(e);
showPayment = true;
}}>
Add new payment method
</ActionMenu.Item.Button>
</ActionMenu.Root>
@@ -262,7 +265,7 @@
<Button secondary icon on:click={toggle}>
<Icon icon={IconPlus} size="s" />
</Button>
<ActionMenu.Root slot="tooltip">
<ActionMenu.Root slot="tooltip" let:toggle>
{#if $paymentMethods.total}
{#each filteredPaymentMethods as paymentMethod}
<ActionMenu.Item.Button
@@ -277,7 +280,10 @@
<Divider />
<ActionMenu.Item.Button
leadingIcon={IconPlus}
on:click={() => (showPayment = true)}>
on:click={(e) => {
toggle(e);
showPayment = true;
}}>
Add new payment method
</ActionMenu.Item.Button>
</ActionMenu.Root>