mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: credit reload
This commit is contained in:
1 parent
3a65123912
commit
2b105cb28b
3 files changed
+14
-2
No files matched your search
@@ -7,7 +7,9 @@
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
export let show = false;
|
||||
let coupon: string = null;
|
||||
|
||||
@@ -25,6 +27,7 @@
|
||||
coupon
|
||||
});
|
||||
coupon = null;
|
||||
dispatch('success');
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import PaymentDetails from './wizard/paymentDetails.svelte';
|
||||
|
||||
async function onFinish() {
|
||||
await invalidate(Dependencies.FUNCTIONS);
|
||||
await invalidate(Dependencies.CREDIT);
|
||||
}
|
||||
|
||||
async function create() {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
total: 0
|
||||
};
|
||||
let show = false;
|
||||
let reloadOnWizardClose = false;
|
||||
|
||||
onMount(async () => {
|
||||
request();
|
||||
@@ -37,6 +38,7 @@
|
||||
show = true;
|
||||
} else {
|
||||
wizard.start(AddCreditWizard);
|
||||
reloadOnWizardClose = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +58,13 @@
|
||||
(acc: number, curr: Credit) => acc + curr.creditsRemaining,
|
||||
0
|
||||
);
|
||||
|
||||
$: {
|
||||
if (reloadOnWizardClose && !$wizard.show) {
|
||||
request();
|
||||
reloadOnWizardClose = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<CardGrid>
|
||||
@@ -107,4 +116,4 @@
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
|
||||
<AddCreditModal bind:show />
|
||||
<AddCreditModal bind:show on:success={request} />
|
||||
Reference in new issue
Block a user