0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Refined portal preview amount values when switching discount type

no refs
This commit is contained in:
Rishabh 2021-10-22 10:09:56 +05:30
parent 161c53ca38
commit c366eaa5ba

View file

@ -291,11 +291,12 @@ export default class OffersController extends Controller {
@action
setDiscountType(discountType) {
if (!this.isDiscountSectionDisabled) {
const amount = this.offer.amount || 0;
this._saveOfferProperty('type', discountType);
if (this.offer.type === 'fixed' && this.offer.amount !== '') {
this.offer.amount = this.offer.amount * 100;
this.offer.amount = amount * 100;
} else if (this.offer.amount !== '') {
this.offer.amount = this.offer.amount / 100;
this.offer.amount = amount / 100;
}
this.updatePortalPreview({forceRefresh: false});
}