fix: Set organization after creation

This commit is contained in:
2025-08-11 06:30:00 +02:00
parent 825ed64b0e
commit 851d0fef46
2 changed files with 30 additions and 8 deletions

View File

@@ -36,7 +36,9 @@
import * as z from 'zod'
import { useBetterAuth } from '~/composables/useBetterAuth'
const emit = defineEmits(['formSubmitted'])
const emit = defineEmits<{
(e: 'organizationCreated', id: string | undefined): void
}>()
const { createOrganization } = useBetterAuth()
const open = ref(false)
@@ -92,8 +94,8 @@ async function onSubmit() {
if (!state.name || !state.slug) return
await createOrganization(state.name, state.slug, state.logo)
emit('formSubmitted', { name: state.name, slug: state.slug })
const organization = await createOrganization(state.name, state.slug, state.logo)
emit('organizationCreated', organization.data?.id)
loading.value = false
open.value = false
}