From d9e8f8106ac5c91faea2a814c7049481509a15eb Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 11 Sep 2022 07:02:39 +0200 Subject: [PATCH] Fix https://github.com/firefly-iii/firefly-iii/issues/6379 --- .../transactions/ForeignAmountSelect.vue | 52 +++++++++++-------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/resources/assets/js/components/transactions/ForeignAmountSelect.vue b/resources/assets/js/components/transactions/ForeignAmountSelect.vue index a03455c082..4b867b2771 100644 --- a/resources/assets/js/components/transactions/ForeignAmountSelect.vue +++ b/resources/assets/js/components/transactions/ForeignAmountSelect.vue @@ -176,28 +176,34 @@ export default { } }, loadCurrencies: function () { - //console.log('loadCurrencies'); - let URI = document.getElementsByTagName('base')[0].href + "api/v1/currencies"; - axios.get(URI, {}).then((res) => { - this.currencies = [ - { - id: 0, - attributes: { - name: this.no_currency, - enabled: true - }, - } - ]; + // reset list of currencies: + this.currencies = [ + { + id: 0, + attributes: { + name: this.no_currency, + enabled: true + }, + } + ]; + + this.enabledCurrencies = [ + { + attributes: { + name: this.no_currency, + enabled: true + }, + id: 0, + } + ]; + + this.getCurrencies(1); + }, + getCurrencies: function(page) { + console.log('loadCurrencies on page ' + page); + let url = document.getElementsByTagName('base')[0].href + "api/v1/currencies?page=" + page; + axios.get(url, {}).then((res) => { - this.enabledCurrencies = [ - { - attributes: { - name: this.no_currency, - enabled: true - }, - id: 0, - } - ]; for (const key in res.data.data) { if (res.data.data.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) { if (res.data.data[key].attributes.enabled) { @@ -207,7 +213,9 @@ export default { } } } - // console.log(this.enabledCurrencies); + if(res.data.meta.pagination.current_page < res.data.meta.pagination.total_pages) { + this.getCurrencies(res.data.meta.pagination.current_page + 1); + } }); } }