fix: always send period_discounts in promo group updates

When all period discounts were removed, the frontend sent undefined
(field absent from JSON), so the backend never cleared them.
Now always sends the field - empty object {} to clear, or populated
object to update.
This commit is contained in:
Fringg
2026-04-15 04:13:53 +03:00
parent 3a865a472b
commit d15c2408df

View File

@@ -150,8 +150,7 @@ export default function AdminPromoGroupCreate() {
server_discount_percent: serverVal,
traffic_discount_percent: trafficVal,
device_discount_percent: deviceVal,
period_discounts:
Object.keys(periodDiscountsRecord).length > 0 ? periodDiscountsRecord : undefined,
period_discounts: periodDiscountsRecord,
apply_discounts_to_addons: applyToAddons,
auto_assign_total_spent_kopeks: autoAssignVal > 0 ? Math.round(autoAssignVal * 100) : 0,
is_default: isDefault,