diff --git a/bookstore-api/.idea/workspace.xml b/bookstore-api/.idea/workspace.xml index 071577f..5fed2b9 100644 --- a/bookstore-api/.idea/workspace.xml +++ b/bookstore-api/.idea/workspace.xml @@ -1020,12 +1020,12 @@ - + - diff --git a/store-front/src/app/components/order/order.component.ts b/store-front/src/app/components/order/order.component.ts index 676d63d..9c96c70 100644 --- a/store-front/src/app/components/order/order.component.ts +++ b/store-front/src/app/components/order/order.component.ts @@ -172,7 +172,16 @@ export class OrderComponent implements OnInit { res=>{ console.log(res.json()); this.userShippingList=res.json(); - this.emptyShippingList = false; + if(this.userShippingList.length) { + this.emptyShippingList = false; + + for (let userShipping of this.userShippingList) { + if(userShipping.userShippingDefault) { + this.setShippingAddress(userShipping); + return; + } + } + } }, error=>{ console.log(error.text()); @@ -184,6 +193,17 @@ export class OrderComponent implements OnInit { console.log(res.json()); this.userPaymentList=res.json(); this.emptyPaymentList = false; + + if(this.userPaymentList.length) { + this.emptyPaymentList = false; + + for (let userPayment of this.userPaymentList) { + if(userPayment.defaultPayment) { + this.setPaymentMethod(userPayment); + return; + } + } + } }, error=>{ console.log(error.text());