1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<!-- eslint-disable vue/multi-word-component-names -->
<script>
import { fetchPolicies } from '~/lib/graphql';
import customEmojisQuery from '../queries/custom_emojis.query.graphql';
import List from '../components/list.vue';
export default {
apollo: {
customEmojis: {
fetchPolicy: fetchPolicies.NETWORK_ONLY,
query: customEmojisQuery,
update: (r) => r.group?.customEmoji?.nodes,
variables() {
return {
groupPath: this.groupPath,
...this.pagination,
};
},
result({ data }) {
const pageInfo = data.group?.customEmoji?.pageInfo;
this.count = data.group?.customEmoji?.count;
this.userPermissions = data.group?.userPermissions;
if (pageInfo) {
this.pageInfo = pageInfo;
}
},
},
},
components: {
List,
},
inject: {
groupPath: {
default: '',
},
},
data() {
return {
customEmojis: [],
count: 0,
pageInfo: {},
pagination: {},
userPermissions: {},
};
},
methods: {
refetchCustomEmojis() {
this.$apollo.queries.customEmojis.refetch();
},
changePage(pageInfo) {
this.pagination = pageInfo;
},
},
};
</script>
<template>
<list
:count="count"
:loading="$apollo.queries.customEmojis.loading"
:page-info="pageInfo"
:custom-emojis="customEmojis"
:user-permissions="userPermissions"
@input="changePage"
/>
</template>
|