Make sure query is reloded after asking to join a group

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-05-18 17:12:45 +02:00
parent a56f28f98e
commit c1fd7d558d
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -545,6 +545,7 @@ import { IMember } from "@/types/actor/member.model";
import RouteName from "../../router/name"; import RouteName from "../../router/name";
import GroupSection from "../../components/Group/GroupSection.vue"; import GroupSection from "../../components/Group/GroupSection.vue";
import ReportModal from "../../components/Report/ReportModal.vue"; import ReportModal from "../../components/Report/ReportModal.vue";
import { PERSON_MEMBERSHIP_GROUP } from "@/graphql/actor";
@Component({ @Component({
apollo: { apollo: {
@ -604,11 +605,24 @@ export default class Group extends mixins(GroupMixin) {
} }
async joinGroup(): Promise<void> { async joinGroup(): Promise<void> {
const [group, currentActorId] = [
usernameWithDomain(this.group),
this.currentActor.id,
];
this.$apollo.mutate({ this.$apollo.mutate({
mutation: JOIN_GROUP, mutation: JOIN_GROUP,
variables: { variables: {
groupId: this.group.id, groupId: this.group.id,
}, },
refetchQueries: [
{
query: PERSON_MEMBERSHIP_GROUP,
variables: {
id: currentActorId,
group,
},
},
],
}); });
} }