fix(frontend): Better Auth list organizations
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<USelect
|
<USelect
|
||||||
v-model="selectedOrgId"
|
v-model="selectedOrgId"
|
||||||
:items="selectItems"
|
:items="availableOrganizations"
|
||||||
value-key="value"
|
value-key="value"
|
||||||
placeholder="Select organization"
|
placeholder="Select organization"
|
||||||
class="w-64"
|
class="w-64"
|
||||||
@@ -141,11 +141,10 @@ import { useClipboard } from '@vueuse/core'
|
|||||||
const { copy, copied } = useClipboard()
|
const { copy, copied } = useClipboard()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|
||||||
const { organization, client } = useAuth()
|
const { organization } = useAuth()
|
||||||
const organizations = computed(() => client.useListOrganizations.value?.data || [])
|
const organizations = (await organization.list()).data || []
|
||||||
const { deleteOrganization: betterAuthDeleteOrganization, activeOrganization, selectedOrgId } = useBetterAuth()
|
const { deleteOrganization: betterAuthDeleteOrganization, activeOrganization, selectedOrgId } = useBetterAuth()
|
||||||
|
const availableOrganizations = computed(() => organizations.map((org) => ({ label: org.name, value: org.id })))
|
||||||
const selectItems = computed(() => organizations.value.map((org) => ({ label: org.name, value: org.id })))
|
|
||||||
|
|
||||||
watch(selectedOrgId, async (newId) => {
|
watch(selectedOrgId, async (newId) => {
|
||||||
const { data } = await organization.setActive({ organizationId: newId || null })
|
const { data } = await organization.setActive({ organizationId: newId || null })
|
||||||
|
|||||||
Reference in New Issue
Block a user