setup open creations query for admin

This commit is contained in:
Moriz Wahl 2023-03-10 10:07:59 +01:00
parent c7e7595f18
commit 7be971b81f
3 changed files with 32 additions and 5 deletions

View File

@ -75,6 +75,7 @@
</template>
<script>
import { adminUpdateContribution } from '../graphql/adminUpdateContribution'
import { openCreations } from '../graphql/openCreations'
import { creationMonths } from '../mixins/creationMonths'
export default {
@ -96,10 +97,6 @@ export default {
type: Object,
required: true,
},
creation: {
type: Array,
required: true,
},
},
data() {
return {
@ -108,6 +105,7 @@ export default {
rangeMin: 0,
rangeMax: 1000,
selected: '',
creation: [0, 0, 0],
}
},
methods: {
@ -151,6 +149,25 @@ export default {
})
},
},
apollo: {
OpenCreations: {
query() {
return openCreations
},
fetchPolicy: 'network-only',
variables() {
return {
userId: this.item.userId,
}
},
update({ openCreations }) {
this.creation = openCreations.map((c) => c.amount)
},
error({ message }) {
this.toastError(message)
},
},
},
created() {
if (this.creationUserData.date) {
const month = this.$d(new Date(this.creationUserData.date), 'month')

View File

@ -92,7 +92,6 @@
<div v-if="row.item.moderator">
<edit-creation-formular
type="singleCreation"
:creation="row.item.creation"
:item="row.item"
:row="row"
:creationUserData="creationUserData"

View File

@ -0,0 +1,11 @@
import gql from 'graphql-tag'
export const openCreations = gql`
query ($userId: Int) {
openCreations(userId: $userID) {
year
month
amount
}
}
`