Fix loading group members in organizer picker

Closes #1216

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-12-21 17:10:51 +01:00
parent c335e7069b
commit 5929a85ec7
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -76,7 +76,7 @@
v-model:actorFilter="actorFilter"
/>
</div>
<div class="max-h-[400px] overflow-y-auto">
<div class="pl-2 max-h-[400px] overflow-y-auto">
<div v-if="isSelectedActorAGroup">
<p>{{ $t("Add a contact") }}</p>
<o-input
@ -166,6 +166,8 @@ import { useRoute } from "vue-router";
import AccountCircle from "vue-material-design-icons/AccountCircle.vue";
import debounce from "lodash/debounce";
import { IUser } from "@/types/current-user.model";
import { IMember } from "@/types/actor/member.model";
import { Paginate } from "@/types/paginate";
const MEMBER_ROLES = [
MemberRole.CREATOR,
@ -233,7 +235,7 @@ const isComponentModalActive = ref(false);
const contactFilter = ref("");
const membersPage = ref(1);
const { result: membersResult } = useQuery(
const { result: membersResult } = useQuery<{ group: Pick<IGroup, 'members'> }>(
GROUP_MEMBERS,
() => ({
groupName: usernameWithDomain(selectedActor.value),
@ -245,8 +247,8 @@ const { result: membersResult } = useQuery(
() => ({ enabled: selectedActor.value?.type === ActorType.GROUP })
);
const members = computed(
() => membersResult.value?.members ?? { elements: [], total: 0 }
const members = computed<Paginate<IMember>>(
() => selectedActor.value?.type === ActorType.GROUP ? membersResult.value?.group?.members ?? { elements: [], total: 0 } : { elements: [], total: 0 }
);
const actualContacts = computed({