feat(frontend): Move better auth functions into separate file

This commit is contained in:
2025-04-06 18:37:18 +02:00
parent eed4b673c0
commit 068dc1305f
3 changed files with 61 additions and 43 deletions

View File

@@ -141,10 +141,8 @@ import { useClipboard } from '@vueuse/core'
const { copy, copied } = useClipboard()
const toast = useToast()
const selectedOrgId = ref<string | undefined>(undefined)
const activeOrganization = ref<ActiveOrganization | null>(null)
const organizations = computed(() => useListOrganizations().value.data || [])
const { deleteOrganization: betterAuthDeleteOrganization, activeOrganization, selectedOrgId } = useBetterAuth()
const selectItems = computed(() => organizations.value.map((org) => ({ label: org.name, value: org.id })))
@@ -201,18 +199,6 @@ async function deleteOrganization() {
if (!confirmed) return
await authClient.organization.delete(
{ organizationId: activeOrganization.value.id },
{
onSuccess: () => {
toast.add({ title: 'Organization deleted', color: 'success' })
activeOrganization.value = null
selectedOrgId.value = undefined
},
onError: (ctx) => {
toast.add({ title: 'Error deleting organization', description: ctx.error.message, color: 'error' })
}
}
)
await betterAuthDeleteOrganization()
}
</script>