Fix approving/rejecting group members

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-11-22 12:17:52 +01:00
parent 8e7907ec9e
commit 4073eab201
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -184,7 +184,7 @@
<o-button <o-button
variant="success" variant="success"
v-if="props.row.role === MemberRole.NOT_APPROVED" v-if="props.row.role === MemberRole.NOT_APPROVED"
@click="approveMember(props.row.id)" @click="approveMember({ memberId: props.row.id })"
icon-left="check" icon-left="check"
>{{ t("Approve member") }}</o-button >{{ t("Approve member") }}</o-button
> >
@ -238,7 +238,6 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { FETCH_GROUP } from "@/graphql/group";
import { MemberRole } from "@/types/enums"; import { MemberRole } from "@/types/enums";
import { IMember } from "@/types/actor/member.model"; import { IMember } from "@/types/actor/member.model";
import RouteName from "@/router/name"; import RouteName from "@/router/name";
@ -312,6 +311,12 @@ const {
refetchQueries: [ refetchQueries: [
{ {
query: GROUP_MEMBERS, query: GROUP_MEMBERS,
variables: {
groupName: props.preferredUsername,
page: page.value,
limit: MEMBERS_PER_PAGE,
roles: roles.value,
},
}, },
], ],
})); }));
@ -363,6 +368,12 @@ const {
refetchQueries: [ refetchQueries: [
{ {
query: GROUP_MEMBERS, query: GROUP_MEMBERS,
variables: {
groupName: props.preferredUsername,
page: page.value,
limit: MEMBERS_PER_PAGE,
roles: roles.value,
},
}, },
], ],
})); }));
@ -423,7 +434,20 @@ const {
onDone: onApproveMemberDone, onDone: onApproveMemberDone,
onError: onApproveMemberError, onError: onApproveMemberError,
} = useMutation<{ approveMember: IMember }, { memberId: string }>( } = useMutation<{ approveMember: IMember }, { memberId: string }>(
APPROVE_MEMBER APPROVE_MEMBER,
{
refetchQueries: [
{
query: GROUP_MEMBERS,
variables: {
groupName: props.preferredUsername,
page: page.value,
limit: MEMBERS_PER_PAGE,
roles: roles.value,
},
},
],
}
); );
onApproveMemberDone(() => { onApproveMemberDone(() => {
@ -452,8 +476,13 @@ const {
>(UPDATE_MEMBER, () => ({ >(UPDATE_MEMBER, () => ({
refetchQueries: [ refetchQueries: [
{ {
query: FETCH_GROUP, query: GROUP_MEMBERS,
variables: { name: props.preferredUsername }, variables: {
groupName: props.preferredUsername,
page: page.value,
limit: MEMBERS_PER_PAGE,
roles: roles.value,
},
}, },
], ],
})); }));