Fix event participants pagination

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-11-24 16:05:52 +01:00
parent ef954569f4
commit baa8582df7
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -90,6 +90,7 @@
:show-detail-icon="false" :show-detail-icon="false"
:loading="this.$apollo.loading" :loading="this.$apollo.loading"
paginated paginated
:current-page="page"
backend-pagination backend-pagination
:pagination-simple="true" :pagination-simple="true"
:aria-next-label="$t('Next page')" :aria-next-label="$t('Next page')"
@ -259,7 +260,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue, Watch, Ref } from "vue-property-decorator"; import { Component, Prop, Vue, Ref } from "vue-property-decorator";
import { ParticipantRole } from "@/types/enums"; import { ParticipantRole } from "@/types/enums";
import { IParticipant } from "../../types/participant.model"; import { IParticipant } from "../../types/participant.model";
import { IEvent, IEventParticipantStats } from "../../types/event.model"; import { IEvent, IEventParticipantStats } from "../../types/event.model";
@ -369,17 +370,6 @@ export default class Participants extends Vue {
return this.event.participantStats; return this.event.participantStats;
} }
@Watch("page")
loadMoreParticipants(): void {
this.$apollo.queries.event.fetchMore({
// New variables
variables: {
page: this.page,
limit: this.limit,
},
});
}
async acceptParticipant(participant: IParticipant): Promise<void> { async acceptParticipant(participant: IParticipant): Promise<void> {
try { try {
await this.$apollo.mutate({ await this.$apollo.mutate({
@ -521,6 +511,7 @@ export default class Participants extends Vue {
name: routeName, name: routeName,
query: { ...this.$route.query, ...args }, query: { ...this.$route.query, ...args },
}); });
this.$apollo.queries.event.refetch();
} catch (e) { } catch (e) {
if (isNavigationFailure(e, NavigationFailureType.redirected)) { if (isNavigationFailure(e, NavigationFailureType.redirected)) {
throw Error(e.toString()); throw Error(e.toString());