fix switch
This commit is contained in:
parent
e057333c0d
commit
cc65d8b257
@ -220,7 +220,9 @@ export function findDiscountFactorById(discounts: AnyDiscount[], id: string, pri
|
||||
if (!discount) throw new Error("Discount not found by id");
|
||||
|
||||
switch (discount.conditionType) {
|
||||
case "cartPurchasesAmount" || "purchasesAmount":
|
||||
case "cartPurchasesAmount":
|
||||
return discount.factor;
|
||||
case "purchasesAmount":
|
||||
return discount.factor;
|
||||
case "privilege": {
|
||||
const product = discount.target.products.find(product => product.privilegeId === privilegeId);
|
||||
@ -239,8 +241,6 @@ export function findDiscountFactorById(discounts: AnyDiscount[], id: string, pri
|
||||
case "userType":
|
||||
return discount.target.factor;
|
||||
}
|
||||
|
||||
throw new Error(`Unknown discount condition type: ${discount.conditionType}`);
|
||||
}
|
||||
|
||||
export function formatDiscountFactor(factor: number): string {
|
||||
|
Loading…
Reference in New Issue
Block a user