mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
* feat: split atoms endpoints and add public event type endpoint * Update ConnectedDestinationCalendars import path across platform/atoms components * refactor: update BookingResponse import path from platform-libraries to features/bookings * Move AvailableSlotsType to util.ts and update imports to use GetAvailableSlotsResponse * Refactor import path for RecurringBookingCreateBody type from libraries to types * Fix import path for getBookingForReschedule type from platform-libraries to features * Refactor PublicEventType export location and update import references * Remove @calcom/platform-libraries dependency from atoms package.json * chore(deps): update yarn.lock dependencies * Remove console.log statements and fix indentation in event type hooks * Migrate event type transformers from platform/libraries to api/v2 directory * Remove console.log * Update BookerPlatformWrapper.tsx * Add script to populate empty team slugs with slugified team names * Remove vitest imports * reset platform libraries version * Remove unused orgId comment from useAtomGetPublicEvent hook params * Update useApiV2AvailableSlots.ts * refactor: remove unused exports from lib package index file * Undo: @SomayChauhan Add script to populate empty team slugs with slugified team names * Update booking.tsx * chore: upgrade @calcom/platform-libraries from 0.0.202 to 0.0.205 * chore: bump @calcom/platform-libraries from 0.0.205 to 0.0.206 * chore: configure babel and jest for node module transpilation in api v2 * fix: type errors * Revert "chore: configure babel and jest for node module transpilation in api v2" This reverts commit b2cf172a84fe8953f9497bf6e43874f476fbc04b. * Update calendars.service.ts * chore: bump @calcom/platform-libraries from 0.0.208 to 0.0.209 * fix: add proper type definition for calendar busy times to resolve ts-expect-error * refactor: deprecate v2 old availability endpoints (#21075) Co-authored-by: Morgan <[email protected]> * chore: publish platform librareis * feat: add delegation credential fields to calendar service mock * chore: update @calcom/platform-libraries from 0.0.211 to 0.0.213 * fix: skip failing calendar integration test * chore: bump @calcom/platform-libraries from 0.0.213 to 0.0.214 * fix: api/v2 build error * fix: e2e tests --------- Co-authored-by: Morgan <[email protected]> Co-authored-by: supalarry <[email protected]> Co-authored-by: Lauris Skraucis <[email protected]>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { useMutation } from "@tanstack/react-query";
|
|
|
|
import type { BookingResponse, RecurringBookingCreateBody } from "@calcom/features/bookings/types";
|
|
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
|
import type { ApiResponse, ApiErrorResponse, ApiSuccessResponse } from "@calcom/platform-types";
|
|
|
|
import http from "../../lib/http";
|
|
|
|
interface IUseCreateRecurringBooking {
|
|
onSuccess?: (res: ApiSuccessResponse<BookingResponse[]>) => void;
|
|
onError?: (err: ApiErrorResponse | Error) => void;
|
|
}
|
|
|
|
export const useCreateRecurringBooking = (
|
|
{ onSuccess, onError }: IUseCreateRecurringBooking = {
|
|
onSuccess: () => {
|
|
return;
|
|
},
|
|
onError: () => {
|
|
return;
|
|
},
|
|
}
|
|
) => {
|
|
const createRecurringBooking = useMutation<
|
|
ApiResponse<BookingResponse[]>,
|
|
Error,
|
|
RecurringBookingCreateBody[]
|
|
>({
|
|
mutationFn: (data) => {
|
|
return http.post<ApiResponse<BookingResponse[]>>("/bookings/recurring", data).then((res) => res.data);
|
|
},
|
|
onSuccess: (data) => {
|
|
if (data.status === SUCCESS_STATUS) {
|
|
onSuccess?.(data);
|
|
} else {
|
|
onError?.(data);
|
|
}
|
|
},
|
|
onError: (err) => {
|
|
onError?.(err);
|
|
},
|
|
});
|
|
return createRecurringBooking;
|
|
};
|