From 912cfa488904a96fa1f8074b34d9770083d64803 Mon Sep 17 00:00:00 2001 From: brozanski <100760688+brozanski@users.noreply.github.com> Date: Wed, 17 Apr 2024 11:08:21 +0200 Subject: [PATCH] Currency account troubleshooting --- .../MVC/dto/ForeignCurrencyAccountDto.java | 4 +- .../currency-account.component.html | 19 ++++++++ .../currency-account.component.ts | 46 ++++++++++++++++--- 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/Back/Spring/backend/src/main/java/pl/kantor/backend/MVC/dto/ForeignCurrencyAccountDto.java b/Back/Spring/backend/src/main/java/pl/kantor/backend/MVC/dto/ForeignCurrencyAccountDto.java index 05e81edb..57a60378 100644 --- a/Back/Spring/backend/src/main/java/pl/kantor/backend/MVC/dto/ForeignCurrencyAccountDto.java +++ b/Back/Spring/backend/src/main/java/pl/kantor/backend/MVC/dto/ForeignCurrencyAccountDto.java @@ -13,8 +13,8 @@ @NoArgsConstructor public class ForeignCurrencyAccountDto { private Long id; - private String curencyCode; - private String curencyName; + private String curencyCode; //!TODO zmienić na currencyCode + private String curencyName; //!TODO zmienić na currencyName private String balance; private Long userId; diff --git a/Front/kantor-angular/src/app/currency-account/currency-account.component.html b/Front/kantor-angular/src/app/currency-account/currency-account.component.html index 241f875c..976a2c1f 100644 --- a/Front/kantor-angular/src/app/currency-account/currency-account.component.html +++ b/Front/kantor-angular/src/app/currency-account/currency-account.component.html @@ -14,3 +14,22 @@
{{ account.curencyName }}
+ + +

Create Currency Account

+ +
+
+ + +
+
+ + +
+
+ + +
+ +
diff --git a/Front/kantor-angular/src/app/currency-account/currency-account.component.ts b/Front/kantor-angular/src/app/currency-account/currency-account.component.ts index c7b42cc1..e5c9c3a3 100644 --- a/Front/kantor-angular/src/app/currency-account/currency-account.component.ts +++ b/Front/kantor-angular/src/app/currency-account/currency-account.component.ts @@ -11,14 +11,48 @@ export class CurrencyAccountComponent implements OnInit { constructor(private axiosService: AxiosService) { } - ngOnInit(): void { - this.axiosService.requestWithOutData( - "POST", - "/api/ForeignCurrencyAccount/getCurrencyAccounts" - ).then((response) => { - this.axiosService.getAuthTocken(); + getCurrencyAccounts(): void { + this.axiosService.request("POST", + "/api/ForeignCurrencyAccount/getCurrencyAccounts", + {}).then((response) => { this.accounts = response.data; console.log(this.accounts); }); } + + createCurrencyAccount(newAccount: { curencyCode: string, balance: number, userId: number }): void { + this.axiosService.request("POST", "/api/ForeignCurrencyAccount/createCurrencyAccount", newAccount).then((response) => { + console.log(response.data); + this.getCurrencyAccounts(); // Refresh the accounts list after creating a new account + }); + } + + // createCurrencyAccount(): void { + // let newAccount = { + // curencyCode: 'USD', + // balance: 1000, + // userId: 2 + // }; + // + // this.axiosService.request("POST", "/api/ForeignCurrencyAccount/createCurrencyAccount", newAccount).then((response) => { + // console.log(response.data); + // }); + // } + + ngOnInit(): void { + this.getCurrencyAccounts(); + // this.createCurrencyAccount() + + + // this.axiosService.requestWithOutData( + // "POST", + // "/api/ForeignCurrencyAccount/getCurrencyAccounts" + // ).then((response) => { + // this.axiosService.getAuthTocken(); + // this.accounts = response.data; + // console.log(this.accounts); + // + // }); + + } }