mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add varibles object, add computed and watch currentPage
This commit is contained in:
parent
90ce74a98c
commit
1a89d94bda
@ -25,8 +25,9 @@
|
|||||||
|
|
||||||
<b-collapse :class="visible ? 'bg-secondary' : ''" class="pb-4 pt-5" v-model="visible">
|
<b-collapse :class="visible ? 'bg-secondary' : ''" class="pb-4 pt-5" v-model="visible">
|
||||||
<collapse-links-list
|
<collapse-links-list
|
||||||
|
v-model="variables"
|
||||||
|
:transactionLinkCount="transactionLinkCount"
|
||||||
:transactionLinks="transactionLinks"
|
:transactionLinks="transactionLinks"
|
||||||
@update-list-transaction-links="updateListTransactionLinks"
|
|
||||||
/>
|
/>
|
||||||
</b-collapse>
|
</b-collapse>
|
||||||
</div>
|
</div>
|
||||||
@ -69,26 +70,50 @@ export default {
|
|||||||
return {
|
return {
|
||||||
visible: false,
|
visible: false,
|
||||||
transactionLinks: [],
|
transactionLinks: [],
|
||||||
|
variables: {
|
||||||
|
currentPage: 1,
|
||||||
|
pending: false,
|
||||||
|
pageSize: 5,
|
||||||
|
itemsShown: 0,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async updateListTransactionLinks() {
|
async updateListTransactionLinks() {
|
||||||
|
if (this.currentPage === 0) {
|
||||||
|
this.transactionLinks = []
|
||||||
|
this.variables.currentPage = 1
|
||||||
|
} else {
|
||||||
|
this.variables.pending = true
|
||||||
this.$apollo
|
this.$apollo
|
||||||
.query({
|
.query({
|
||||||
query: listTransactionLinks,
|
query: listTransactionLinks,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: this.currentPage,
|
||||||
pageSize: 5,
|
|
||||||
},
|
},
|
||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.transactionLinks = result.data.listTransactionLinks
|
this.transactionLinks = [...this.transactionLinks, ...result.data.listTransactionLinks]
|
||||||
this.$emit('update-transactions')
|
this.$emit('update-transactions')
|
||||||
|
this.variables.pending = false
|
||||||
|
this.variables.itemsShown = this.transactionLinks.length
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
this.toastError(err.message)
|
this.toastError(err.message)
|
||||||
|
this.variables.pending = false
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
currentPage() {
|
||||||
|
return this.variables.currentPage
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
currentPage() {
|
||||||
|
this.updateListTransactionLinks()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user