Pass event duration to schedule api call (#9484)
This commit is contained in:
@@ -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,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user