mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Centralized and refactored report mutations and queries
This commit is contained in:
parent
e7fbd169d9
commit
b4f47997b3
@ -68,8 +68,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import gql from 'graphql-tag'
|
|
||||||
import { SweetalertIcon } from 'vue-sweetalert-icons'
|
import { SweetalertIcon } from 'vue-sweetalert-icons'
|
||||||
|
import { reportMutation } from '~/graphql/Moderation.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ReportModal',
|
name: 'ReportModal',
|
||||||
@ -173,13 +173,7 @@ export default {
|
|||||||
// await this.modalData.buttons.confirm.callback()
|
// await this.modalData.buttons.confirm.callback()
|
||||||
this.$apollo
|
this.$apollo
|
||||||
.mutate({
|
.mutate({
|
||||||
mutation: gql`
|
mutation: reportMutation(),
|
||||||
mutation($id: ID!, $reasonCategory: String!, $description: String!) {
|
|
||||||
report(id: $id, reasonCategory: $reasonCategory, description: $description) {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
variables: {
|
variables: {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
reasonCategory: reasonCategory.value,
|
reasonCategory: reasonCategory.value,
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
export default app => {
|
export const reportListQuery = () => {
|
||||||
return gql`
|
return gql`
|
||||||
query {
|
query {
|
||||||
Report(first: 20, orderBy: createdAt_desc) {
|
Report(first: 20, orderBy: createdAt_desc) {
|
||||||
id
|
id
|
||||||
|
createdAt
|
||||||
|
reasonCategory
|
||||||
description
|
description
|
||||||
type
|
type
|
||||||
createdAt
|
|
||||||
submitter {
|
submitter {
|
||||||
id
|
id
|
||||||
slug
|
slug
|
||||||
@ -79,3 +80,13 @@ export default app => {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const reportMutation = () => {
|
||||||
|
return gql`
|
||||||
|
mutation($id: ID!, $reasonCategory: String!, $description: String!) {
|
||||||
|
report(id: $id, reasonCategory: $reasonCategory, description: $description) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
@ -110,7 +110,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import HcEmpty from '~/components/Empty.vue'
|
import HcEmpty from '~/components/Empty.vue'
|
||||||
import query from '~/graphql/ModerationListQuery.js'
|
import { reportListQuery } from '~/graphql/Moderation.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -134,7 +134,7 @@ export default {
|
|||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
Report: {
|
Report: {
|
||||||
query,
|
query: reportListQuery(),
|
||||||
fetchPolicy: 'cache-and-network',
|
fetchPolicy: 'cache-and-network',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user