feat(frontend): Move better auth functions into separate file
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user