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
Udit Takkar 2023-01-31 00:08:22 +05:30 committed by GitHub
parent a4bed48eaf
commit a15b8fb92e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -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")}