From 2372d8bd560f23e38aeb514f1bf0a50684e4b9b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awek=20Zatorski?= Date: Tue, 19 Nov 2024 11:54:09 +0100 Subject: [PATCH] fix --- .../transaction-update.component.ts | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/main/webapp/app/entities/transaction/transaction-update.component.ts b/src/main/webapp/app/entities/transaction/transaction-update.component.ts index 1e5f5fd..6bf4f7d 100644 --- a/src/main/webapp/app/entities/transaction/transaction-update.component.ts +++ b/src/main/webapp/app/entities/transaction/transaction-update.component.ts @@ -40,9 +40,11 @@ export default defineComponent({ const retrieveTransaction = async transactionId => { try { - const res2 = await userAccountService().retrieve(); - console.log('got accounts' + res2); - dictUserAccounts.value = res2.data; + if (dictUserAccounts.value.length == 0) { + const res2 = await userAccountService().retrieve(); + console.log('got accounts' + res2); + dictUserAccounts.value = res2.data; + } const res = await transactionService().find(transactionId); transaction.value = res; // console.log('len'+transaction.value.transactionItems?.length); @@ -59,17 +61,19 @@ export default defineComponent({ } }; - // const retrieveUserAccounts = async () => { - // try { - // const res = await userAccountService().retrieve(); - // console.log('got accounts'+ res); - // dictUserAccounts.value = res.data; - // } catch (error) { - // alertService.showHttpError(error.response); - // } - // }; - // - // retrieveUserAccounts(); + const retrieveUserAccounts = async () => { + if (dictUserAccounts.value.length == 0) { + try { + const res = await userAccountService().retrieve(); + console.log('got accounts' + res); + dictUserAccounts.value = res.data; + } catch (error) { + alertService.showHttpError(error.response); + } + } + }; + + retrieveUserAccounts(); if (route.params?.transactionId) { retrieveTransaction(route.params.transactionId);