feat(frontend): Add roles

This commit is contained in:
2025-07-28 06:46:31 +02:00
parent 115a12bbf5
commit 7b5a1a3bda
9 changed files with 359 additions and 32 deletions

View File

@@ -1,3 +1,6 @@
import type { ActiveOrganization } from '~/types/betterAuth'
import type { LegalRole } from '~/server/utils/permissions'
const activeOrganization = ref<ActiveOrganization | null>(null)
const selectedOrgId = ref<string | undefined>(undefined)
@@ -7,7 +10,7 @@ export function useBetterAuth() {
async function createOrganization(name: string, slug: string, logo?: string) {
const slugCheck = await organization.checkSlug({ slug })
if (!slugCheck.data.available) {
if (!slugCheck.data?.status) {
toast.add({ title: 'Slug bereits vergeben', description: 'Bitte wählen Sie einen anderen Slug', color: 'error' })
return Promise.reject()
}
@@ -62,7 +65,7 @@ export function useBetterAuth() {
})
}
async function inviteMember(email: string, role: 'member' | 'admin') {
async function inviteMember(email: string, role: LegalRole) {
await organization.inviteMember({
email,
role,