Skip to content

Commit a7b83c6

Browse files
authored
Merge pull request #1990 from appwrite/fix-apply-credit
Fix apply credit
2 parents 89881f1 + 6a5363e commit a7b83c6

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,13 @@
246246
billingPlan = getBillingPlan();
247247
}
248248
249-
$: isNewOrg = selectedOrgId && selectedOrgId !== newOrgId;
249+
$: isNewOrg = !(selectedOrgId && selectedOrgId !== newOrgId);
250250
251-
$: {
252-
if (isNewOrg) {
253-
(async () => {
254-
currentPlan = await sdk.forConsole.billing.getOrganizationPlan(selectedOrgId);
255-
})();
256-
}
251+
$: if (!isNewOrg) {
252+
(async () => {
253+
currentPlan = await sdk.forConsole.billing.getOrganizationPlan(selectedOrgId);
254+
})();
255+
loadPaymentMethods();
257256
}
258257
259258
// after adding a payment method, fetch the payment methods again so the input can be updated
@@ -371,7 +370,7 @@
371370
{collaborators}
372371
bind:couponData
373372
bind:billingBudget
374-
organizationId={isNewOrg ? selectedOrgId : null}>
373+
organizationId={!isNewOrg ? selectedOrgId : null}>
375374
{#if campaign?.template === 'review' && (campaign?.cta || campaign?.claimed || campaign?.unclaimed)}
376375
<div class="u-margin-block-end-24">
377376
<p class="body-text-1 u-bold">{campaign?.cta}</p>
@@ -397,7 +396,7 @@
397396
handleSubmit();
398397
}
399398
}}
400-
disabled={$isSubmitting}>
399+
disabled={!couponData?.code || $isSubmitting}>
401400
{#if $isSubmitting}
402401
<span class="loader is-small is-transparent u-line-height-1-5" aria-hidden="true"
403402
></span>

0 commit comments

Comments
 (0)