remove verify login

This commit is contained in:
Moriz Wahl 2023-01-11 22:10:34 +01:00
parent 2d4f7f9fd5
commit edd2fb992e

View File

@ -52,12 +52,7 @@ import OpenCreationsAmount from '@/components/Contributions/OpenCreationsAmount.
import ContributionForm from '@/components/Contributions/ContributionForm.vue' import ContributionForm from '@/components/Contributions/ContributionForm.vue'
import ContributionList from '@/components/Contributions/ContributionList.vue' import ContributionList from '@/components/Contributions/ContributionList.vue'
import { createContribution, updateContribution, deleteContribution } from '@/graphql/mutations' import { createContribution, updateContribution, deleteContribution } from '@/graphql/mutations'
import { import { listContributions, listAllContributions, openCreations } from '@/graphql/queries'
listContributions,
listAllContributions,
verifyLogin,
openCreations,
} from '@/graphql/queries'
export default { export default {
name: 'Community', name: 'Community',
@ -145,15 +140,19 @@ export default {
}, },
maxGddLastMonth() { maxGddLastMonth() {
// when existing contribution is edited, the amount is added back on top of the amount // when existing contribution is edited, the amount is added back on top of the amount
return this.form.id && !this.isThisMonth if (this.openCreations && this.openCreations.length)
? parseInt(this.openCreations[1].amount) + parseInt(this.updateAmount) return this.form.id && !this.isThisMonth
: parseInt(this.openCreations[1].amount) ? parseInt(this.openCreations[1].amount) + parseInt(this.updateAmount)
: parseInt(this.openCreations[1].amount)
return 0
}, },
maxGddThisMonth() { maxGddThisMonth() {
// when existing contribution is edited, the amount is added back on top of the amount // when existing contribution is edited, the amount is added back on top of the amount
return this.form.id && this.isThisMonth if (this.openCreations && this.openCreations.length)
? parseInt(this.openCreations[2].amount) + parseInt(this.updateAmount) return this.form.id && this.isThisMonth
: parseInt(this.openCreations[2].amount) ? parseInt(this.openCreations[2].amount) + parseInt(this.updateAmount)
: parseInt(this.openCreations[2].amount)
return 0
}, },
}, },
methods: { methods: {
@ -183,7 +182,7 @@ export default {
currentPage: this.currentPage, currentPage: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
}) })
this.verifyLogin() this.$apollo.queries.OpenCreations.refetch()
}) })
.catch((err) => { .catch((err) => {
this.toastError(err.message) this.toastError(err.message)
@ -211,7 +210,7 @@ export default {
currentPage: this.currentPage, currentPage: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
}) })
this.verifyLogin() this.$apollo.queries.OpenCreations.refetch()
}) })
.catch((err) => { .catch((err) => {
this.toastError(err.message) this.toastError(err.message)
@ -236,7 +235,7 @@ export default {
currentPage: this.currentPage, currentPage: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
}) })
this.verifyLogin() this.$apollo.queries.OpenCreations.refetch()
}) })
.catch((err) => { .catch((err) => {
this.toastError(err.message) this.toastError(err.message)
@ -291,22 +290,6 @@ export default {
this.toastError(err.message) this.toastError(err.message)
}) })
}, },
verifyLogin() {
this.$apollo
.query({
query: verifyLogin,
fetchPolicy: 'network-only',
})
.then((result) => {
const {
data: { verifyLogin },
} = result
this.$store.dispatch('login', verifyLogin)
})
.catch(() => {
this.$emit('logout')
})
},
updateContributionForm(item) { updateContributionForm(item) {
this.form.id = item.id this.form.id = item.id
this.form.date = item.contributionDate this.form.date = item.contributionDate
@ -326,8 +309,6 @@ export default {
}, },
created() { created() {
// verifyLogin is important at this point so that creation is updated on reload if they are deleted in a session in the admin area.
this.verifyLogin()
this.updateListContributions({ this.updateListContributions({
currentPage: this.currentPage, currentPage: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,