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
2024-04-17 12:13:02 +02:00
committed by GitHub
2 changed files with 13 additions and 5 deletions
+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} />