Merge pull request #287 from lurumad/dev

Fix bug #259
This commit is contained in:
RamonTC 2017-08-23 13:31:28 +02:00 committed by GitHub
commit 01900b01b2
2 changed files with 26 additions and 14 deletions

View File

@ -25,7 +25,8 @@
<section class="esh-basket-item esh-basket-item--middle col-xs-3">{{item.productName}}</section>
<section class="esh-basket-item esh-basket-item--middle col-xs-2">$ {{item.unitPrice | number:'.2-2'}}</section>
<section class="esh-basket-item esh-basket-item--middle col-xs-2">
<input class="esh-basket-input"
<input id="quantity"
class="esh-basket-input"
type="number"
min="1"
[(ngModel)]="item.quantity"

View File

@ -34,16 +34,27 @@ export class BasketComponent implements OnInit {
this.service.setBasket(this.basket).subscribe(x => console.log('basket updated: ' + x));
}
update(event: any) {
this.service.setBasket(this.basket).catch((errMessage) => {
this.errorMessages = errMessage.messages;
return Observable.throw(errMessage);
}).subscribe(x => console.log('basket updated: ' + x));
update(event: any): Observable<boolean> {
let setBasketObservable = this.service.setBasket(this.basket);
setBasketObservable
.subscribe(
x => {
this.errorMessages = [];
console.log('basket updated: ' + x);
},
errMessage => this.errorMessages = errMessage.messages);
return setBasketObservable;
}
checkOut(event: any) {
this.update(event)
.subscribe(
x => {
this.errorMessages = [];
this.basketwrapper.basket = this.basket;
this.router.navigate(['order']);
this.router.navigate(['order'],
errMessage => this.errorMessages = errMessage.messages);
});
}
private calculateTotalPrice() {