Changed the logic of no transactions, sets -1 if error was thrown so that we dont have the error if no transactions are present.

This commit is contained in:
elweyn 2022-01-14 08:47:07 +01:00
parent 47078a9a01
commit 151f497252
3 changed files with 9 additions and 2 deletions

View File

@ -100,6 +100,7 @@ export default {
})
.catch((error) => {
this.pending = true
this.transactionCount = -1
this.$toasted.global.error(error.message)
// what to do when loading balance fails?
})

View File

@ -61,6 +61,12 @@ describe('GddTransactionList', () => {
})
describe('without any properties', () => {
beforeEach(async () => {
await wrapper.setProps({
transactions: [],
transactionCount: -1,
})
})
it('renders text saying that there are error.empty-transactionlist ', () => {
expect(wrapper.find('div.gdd-transaction-list').text()).toContain(
'transaction.nullTransactions',

View File

@ -7,7 +7,7 @@
{{ $t('error.no-transactionlist') }}
</small>
</div>
<div v-if="transactionCount === 'undefined'" class="test-empty-transactionlist text-right">
<div v-if="transactionCount < 0" class="test-empty-transactionlist text-right">
<b-icon icon="exclamation-triangle" class="mr-2" style="color: red"></b-icon>
<small>{{ $t('error.empty-transactionlist') }}</small>
</div>
@ -134,7 +134,7 @@
:per-page="pageSize"
:total-rows="transactionCount"
></pagination-buttons>
<div v-if="transactionCount === 0" class="mt-4 text-center">
<div v-if="transactionCount < 0" class="mt-4 text-center">
<span>{{ $t('transaction.nullTransactions') }}</span>
</div>
</div>