Merge pull request #1043 from appwrite/fix-project-creation

fix: add option to pass final action directly to the wizard so it can be awaited
This commit is contained in:
Arman authored and GitHub committed 2024-04-17 12:13:02 +02:00
commit bbf8faec25
2 files changed
+13 -5

No files matched your search

+12 -4
View File
@@ -24,6 +24,7 @@
export let steps: WizardStepsType;
export let confirmExit = false;
export let finalAction = 'Create';
export let finalMethod: () => Promise<void> = null;
const dispatch = createEventDispatcher();
@@ -94,11 +95,18 @@
}
} else {
$wizard.nextDisabled = true;
trackEvent('wizard_finish');
dispatch('finish');
setTimeout(() => {
if (finalMethod) {
await finalMethod();
trackEvent('wizard_finish');
$wizard.nextDisabled = false;
}, 2000);
} else {
trackEvent('wizard_finish');
dispatch('finish');
setTimeout(() => {
$wizard.nextDisabled = false;
}, 2000);
}
}
} else {
if (steps.get($wizard.step + 1)?.disabled) {
@@ -67,4 +67,4 @@
});
</script>
<Wizard title="Create project" steps={stepsComponents} on:finish={create} on:exit={onFinish} />
<Wizard title="Create project" steps={stepsComponents} finalMethod={create} on:exit={onFinish} />