diff --git a/src/routes/(console)/organization-[organization]/createProjectCloud.svelte b/src/routes/(console)/organization-[organization]/createProjectCloud.svelte index 6ec2dd2683..16f5aa4500 100644 --- a/src/routes/(console)/organization-[organization]/createProjectCloud.svelte +++ b/src/routes/(console)/organization-[organization]/createProjectCloud.svelte @@ -6,8 +6,7 @@ import { Dependencies } from '$lib/constants'; import { page } from '$app/state'; import { Submit, trackEvent, trackError } from '$lib/actions/analytics'; - import { ID, Region as ConsoleRegion, type Models } from '@appwrite.io/console'; - import { createProject } from './wizard/store'; + import { ID, Region as ConsoleRegion, type Models, Region } from '@appwrite.io/console'; import { Button } from '@appwrite.io/pink-svelte'; import { base } from '$app/paths'; import CreateProject from '$lib/layout/createProject.svelte'; @@ -17,6 +16,10 @@ export let regions: Array = []; export let showCreateProjectCloud: boolean; + let id: string = null; + let name: string = 'Appwrite project'; + let region: string = Region.Fra; + async function onFinish() { await invalidate(Dependencies.FUNCTIONS); } @@ -25,19 +28,19 @@ try { // TODO: fix typing once SDK is updated const project = await sdk.forConsole.projects.create( - $createProject?.id ?? ID.unique(), - $createProject.name, + id ?? ID.unique(), + name, teamId, - $createProject.region as ConsoleRegion + region as ConsoleRegion ); trackEvent(Submit.ProjectCreate, { - customId: !!$createProject?.id, + customId: !!id, teamId, - region: $createProject.region + region: region }); addNotification({ type: 'success', - message: `${$createProject.name} has been created` + message: `${name} has been created` }); await onFinish(); await goto(`${base}/project-${project.region}-${project.$id}`); @@ -51,21 +54,14 @@ } onDestroy(() => { - $createProject = { - id: null, - name: null, - region: 'fra' - }; + id = null; + name = null; + region = 'fra'; }); - + Create diff --git a/src/routes/(console)/organization-[organization]/header.svelte b/src/routes/(console)/organization-[organization]/header.svelte index f18c3efb2f..86fe4a0c91 100644 --- a/src/routes/(console)/organization-[organization]/header.svelte +++ b/src/routes/(console)/organization-[organization]/header.svelte @@ -30,7 +30,7 @@ }); $: avatars = $members.memberships?.map((m) => m.userName || m.userEmail) ?? []; - $: organizationId = page.params.organization; + $: organizationId = $organization?.$id ?? page.params.organization; $: path = `${base}/organization-${organizationId}`; $: tabs = [ { @@ -75,7 +75,7 @@ ].filter((tab) => !tab.disabled); -{#if $organization?.$id} +{#if $organization.$id} diff --git a/src/routes/(console)/organization-[organization]/wizard/store.ts b/src/routes/(console)/organization-[organization]/wizard/store.ts deleted file mode 100644 index 0ff9a63513..0000000000 --- a/src/routes/(console)/organization-[organization]/wizard/store.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { writable } from 'svelte/store'; - -export const createProject = writable<{ - id?: string; - name: string; - region: string; -}>({ - id: null, - name: 'Appwrite project', - region: 'fra' -});