fix: booking limits saved as undefined (#6720)
* fix: booking limits saved as undefined Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * fix: add event limit Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> --------- Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>pull/6725/head
parent
a4bed48eaf
commit
a15b8fb92e
|
@ -420,12 +420,14 @@ const BookingLimits = () => {
|
|||
defaultValue={BOOKING_LIMIT_OPTIONS.find((option) => option.value === key)}
|
||||
onChange={(val) => {
|
||||
const current = currentBookingLimits;
|
||||
const currentValue = watchBookingLimits[bookingLimitKey];
|
||||
|
||||
// Removes limit from previous selected value (eg when changed from per_week to per_month, we unset per_week here)
|
||||
delete current[bookingLimitKey];
|
||||
const newData = {
|
||||
...current,
|
||||
// Set limit to new selected value (in the example above this means we set the limit to per_week here).
|
||||
[val?.value as BookingLimitsKey]: watchBookingLimits[bookingLimitKey],
|
||||
[val?.value as BookingLimitsKey]: currentValue,
|
||||
};
|
||||
onChange(newData);
|
||||
}}
|
||||
|
@ -459,7 +461,7 @@ const BookingLimits = () => {
|
|||
|
||||
setValue("bookingLimits", {
|
||||
...watchBookingLimits,
|
||||
[rest[0].value]: undefined,
|
||||
[rest[0].value]: 1,
|
||||
});
|
||||
}}>
|
||||
{t("add_limit")}
|
||||
|
|
Loading…
Reference in New Issue