feat: add exit event to wizard

This commit is contained in:
Torsten Dittmann
2022-10-13 14:43:35 +02:00
parent 93a9c20425
commit 9039b42e0c
6 changed files with 34 additions and 6 deletions
+2 -1
View File
@@ -30,6 +30,7 @@
function handleKeydown(event: KeyboardEvent) {
if (event.key === 'Escape' && !showExitModal) {
event.preventDefault();
dispatch('exit');
wizard.hide();
}
}
@@ -38,6 +39,7 @@
if (confirmExit) {
showExitModal = true;
} else {
dispatch('exit');
wizard.hide();
}
}
@@ -52,7 +54,6 @@
async function submit() {
if ($wizard.interceptor) {
try {
console.log($wizard.interceptor);
await $wizard.interceptor();
} catch (error) {
addNotification({
@@ -9,6 +9,7 @@
import Step2 from './wizard/android/step2.svelte';
import Step3 from './wizard/android/step3.svelte';
import Step4 from './wizard/step4.svelte';
import { createPlatform } from './wizard/store';
const projectId = $page.params.project;
@@ -44,4 +45,5 @@
title="Add an Android Project"
steps={stepsComponents}
on:finish={create}
on:exit={createPlatform.reset}
finalAction="Take me to my Dashboard" />
@@ -9,6 +9,7 @@
import Step2 from './wizard/apple/step2.svelte';
import Step3 from './wizard/apple/step3.svelte';
import Step4 from './wizard/step4.svelte';
import { createPlatform } from './wizard/store';
const projectId = $page.params.project;
@@ -44,4 +45,5 @@
title="Add an Apple Project"
steps={stepsComponents}
on:finish={create}
on:exit={createPlatform.reset}
finalAction="Take me to my Dashboard" />
@@ -9,6 +9,7 @@
import Step2 from './wizard/flutter/step2.svelte';
import Step3 from './wizard/flutter/step3.svelte';
import Step4 from './wizard/step4.svelte';
import { createPlatform } from './wizard/store';
const projectId = $page.params.project;
@@ -44,4 +45,5 @@
title="Add a Flutter Project"
steps={stepsComponents}
on:finish={create}
on:exit={createPlatform.reset}
finalAction="Take me to my Dashboard" />
@@ -9,6 +9,7 @@
import Step2 from './wizard/web/step2.svelte';
import Step3 from './wizard/web/step3.svelte';
import Step4 from './wizard/step4.svelte';
import { createPlatform } from './wizard/store';
const projectId = $page.params.project;
@@ -44,4 +45,5 @@
title="Add a Web Project"
steps={stepsComponents}
on:finish={create}
on:exit={createPlatform.reset}
finalAction="Take me to my Dashboard" />
@@ -3,11 +3,30 @@ import { sdkForConsole } from '$lib/stores/sdk';
import { cachedStore } from '$lib/helpers/cache';
import type { Models } from '@aw-labs/appwrite-console';
export const createPlatform = writable<Partial<Models.Platform>>({
name: null,
hostname: null,
type: null
});
function createPlatformStore() {
const { subscribe, update, set } = writable<Partial<Models.Platform>>({
$id: null,
name: null,
hostname: null,
type: null
});
return {
subscribe,
update,
set,
reset() {
set({
$id: null,
name: null,
hostname: null,
type: null
});
}
};
}
export const createPlatform = createPlatformStore();
export const versions = cachedStore<
{