Merge branch 'master' into review-bugfixed

This commit is contained in:
Alexander Friedland 2021-08-11 22:33:42 +02:00 committed by GitHub
commit 4f964545f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 3 deletions

View File

@ -113,7 +113,6 @@ export default {
data() {
return {
currentPage: 1,
startDecay: 0,
}
},
props: {

View File

@ -127,27 +127,56 @@
</b-row>
</div>
</b-collapse>
<!-- Collaps ENDE -->
</div>
</div>
<pagination-buttons
v-if="transactionGdtCount > pageSize"
:has-next="hasNext"
:has-previous="hasPrevious"
:total-pages="totalPages"
:current-page="currentPage"
@show-next="showNext"
@show-previous="showPrevious"
></pagination-buttons>
</div>
</template>
<script>
import communityAPI from '../../../apis/communityAPI'
import PaginationButtons from '../../../components/PaginationButtons'
export default {
name: 'gdt-transaction-list',
components: {
PaginationButtons,
},
data() {
return {
transactionsGdt: { default: () => [] },
transactionGdtCount: { type: Number, default: 0 },
currentPage: 1,
pageSize: 25,
}
},
computed: {
hasNext() {
return this.currentPage * this.pageSize < this.transactionGdtCount
},
hasPrevious() {
return this.currentPage > 1
},
totalPages() {
return Math.ceil(this.transactionGdtCount / this.pageSize)
},
},
methods: {
async updateGdt() {
const result = await communityAPI.transactionsgdt(this.$store.state.sessionId)
const result = await communityAPI.transactionsgdt(
this.$store.state.sessionId,
this.currentPage,
this.pageSize,
)
if (result.success) {
this.transactionsGdt = result.result.data.gdtEntries
this.transactionGdtCount = result.result.data.count
@ -155,6 +184,16 @@ export default {
this.$toasted.error(result.result.message)
}
},
showNext() {
this.currentPage++
this.updateGdt()
window.scrollTo(0, 0)
},
showPrevious() {
this.currentPage--
this.updateGdt()
window.scrollTo(0, 0)
},
},
mounted() {
this.updateGdt()