Skip to content

Commit

Permalink
fix: update error coupons after change language
Browse files Browse the repository at this point in the history
  • Loading branch information
YulikK committed Jun 22, 2024
1 parent c170eb2 commit 70575a5
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/entities/Summary/view/SummaryView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ class SummaryView {

private updateTitle(): void {
this.discountTotal.innerHTML = '';
const totalDiscountWrap = createBaseElement({ cssClasses: [styles.couponWrap], tag: 'div' });
const totalDiscountTitle = this.getTitle();
const totalDiscountValue = this.getValue(this.total);
totalDiscountWrap.append(totalDiscountTitle, totalDiscountValue);
this.discountTotal.append(totalDiscountWrap);
if (this.total) {
const totalDiscountWrap = createBaseElement({ cssClasses: [styles.couponWrap], tag: 'div' });
const totalDiscountTitle = this.getTitle();
const totalDiscountValue = this.getValue(this.total);
totalDiscountWrap.append(totalDiscountTitle, totalDiscountValue);
this.discountTotal.append(totalDiscountWrap);
}
}

public addCouponItem(coupon: CouponModel): void {
Expand All @@ -78,12 +80,8 @@ class SummaryView {
}

public updateTotal(total: number): void {
if (total) {
this.total = total;
this.updateTitle();
} else {
this.discountTotal.innerHTML = '';
}
this.total = total;
this.updateTitle();
}
}

Expand Down

0 comments on commit 70575a5

Please sign in to comment.