Skip to content

Scheduling infrastructure for absolutely everyone.

Pass event duration to schedule api call (#9484)

Jeroen Reumkens0e76a19c961e
diff --git a/packages/features/bookings/Booker/utils/event.ts b/packages/features/bookings/Booker/utils/event.ts
index 3bdebef3f44..6532968f9f1 100644
--- a/packages/features/bookings/Booker/utils/event.ts
+++ b/packages/features/bookings/Booker/utils/event.ts
@@ -37,8 +37,8 @@ export const useEvent = () => {
export const useScheduleForEvent = ({ prefetchNextMonth }: { prefetchNextMonth?: boolean } = {}) => {
const { timezone } = useTimePreferences();
const event = useEvent();
- const [username, eventSlug, month] = useBookerStore(
- (state) => [state.username, state.eventSlug, state.month],
+ const [username, eventSlug, month, duration] = useBookerStore(
+ (state) => [state.username, state.eventSlug, state.month, state.selectedDuration],
shallow
);
@@ -49,5 +49,6 @@ export const useScheduleForEvent = ({ prefetchNextMonth }: { prefetchNextMonth?:
month,
timezone,
prefetchNextMonth,
+ duration,
});
};
diff --git a/packages/features/schedules/lib/use-schedule/useSchedule.ts b/packages/features/schedules/lib/use-schedule/useSchedule.ts
index 40e1ad20288..33046b9bd28 100644
--- a/packages/features/schedules/lib/use-schedule/useSchedule.ts
+++ b/packages/features/schedules/lib/use-schedule/useSchedule.ts
@@ -8,6 +8,7 @@ type UseScheduleWithCacheArgs = {
month?: string | null;
timezone?: string | null;
prefetchNextMonth?: boolean;
+ duration?: number | null;
};
export const useSchedule = ({
@@ -17,6 +18,7 @@ export const useSchedule = ({
eventSlug,
eventId,
prefetchNextMonth,
+ duration,
}: UseScheduleWithCacheArgs) => {
const monthDayjs = month ? dayjs(month) : dayjs();
const nextMonthDayjs = monthDayjs.add(1, "month");
@@ -35,6 +37,7 @@ export const useSchedule = ({
endTime: (prefetchNextMonth ? nextMonthDayjs : monthDayjs).endOf("month").toISOString(),
timeZone: timezone!,
eventTypeId: eventId!,
+ duration: duration ? `${duration}` : undefined,
},
{
refetchOnWindowFocus: false,