fix(frontend): Loading and removal of members of organization
This commit is contained in:
@@ -56,9 +56,9 @@
|
||||
<!-- Members -->
|
||||
<div class="flex-1">
|
||||
<p class="font-medium mb-2">Members</p>
|
||||
<div v-if="activeOrganization?.members" class="space-y-2">
|
||||
<div v-if="activeOrganizationMembers" class="space-y-2">
|
||||
<div
|
||||
v-for="member in activeOrganization.members"
|
||||
v-for="member in activeOrganizationMembers"
|
||||
:key="member.id"
|
||||
class="flex justify-between items-center"
|
||||
>
|
||||
@@ -70,7 +70,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="user && canRemove({ role: 'owner' }, member)">
|
||||
<UButton size="xs" color="error" @click="organization.removeMember({ memberIdOrEmail: member.id })">
|
||||
<UButton size="xs" color="error" @click="organizationStore.removeMember(member.id)">
|
||||
{{ member.user.id === user.id ? 'Leave' : 'Remove' }}
|
||||
</UButton>
|
||||
</div>
|
||||
@@ -140,15 +140,14 @@ import { useClipboard } from '@vueuse/core'
|
||||
import type { Invitation } from 'better-auth/plugins'
|
||||
|
||||
const { copy, copied } = useClipboard()
|
||||
const { organization, user } = useAuth()
|
||||
const { user } = useAuth()
|
||||
const organizationStore = useOrganizationStore()
|
||||
const { deleteOrganization: betterAuthDeleteOrganization, loadOrganizations } = organizationStore
|
||||
const { activeOrganization, organizations, invitations } = storeToRefs(organizationStore)
|
||||
const { activeOrganization, activeOrganizationMembers, organizations, invitations } = storeToRefs(organizationStore)
|
||||
|
||||
const isRevoking = ref<string[]>([])
|
||||
|
||||
onMounted(async () => {
|
||||
await loadOrganizations()
|
||||
await organizationStore.loadOrganizations()
|
||||
})
|
||||
|
||||
const labeledOrganizations = computed(() => organizations.value.map((org) => ({ label: org.name, value: org.id })))
|
||||
@@ -187,6 +186,6 @@ async function deleteOrganization() {
|
||||
|
||||
if (!confirmed) return
|
||||
|
||||
await betterAuthDeleteOrganization()
|
||||
await organizationStore.deleteOrganization()
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user