diff --git a/src/routes/console/organization-[organization]/deleteOrganization.svelte b/src/routes/console/organization-[organization]/deleteOrganization.svelte index 8f6be48cc..65b28e4ef 100644 --- a/src/routes/console/organization-[organization]/deleteOrganization.svelte +++ b/src/routes/console/organization-[organization]/deleteOrganization.svelte @@ -8,12 +8,26 @@ import { base } from '$app/paths'; import { Dependencies } from '$lib/constants'; import { trackEvent } from '$lib/actions/analytics'; + import { Query } from "@aw-labs/appwrite-console"; + import { FormList, InputPassword, InputText } from "$lib/elements/forms/index.js"; export let showDelete = false; + let password: string = null; + let name: string = null; + const deleteOrg = async () => { try { await sdkForConsole.teams.delete($organization.$id); + + const projectList = await sdkForConsole.projects.list([ + Query.equal('teamId', $organization.$id), + ]) + + await Promise.all(projectList.projects.map(async (project) => { + await sdkForConsole.projects.delete(project.$id, password); + })); + addNotification({ type: 'success', message: `${$organization.name} has been deleted` @@ -42,8 +56,27 @@ Are you sure you want to delete {$organization.name}? All projects ({$organization.total}) and data associated with this organization will be deleted. This action is irreversible.
+ +