mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
* feat: added zoom, office365-video as valid event-type locations * added docs * Update stripe.service.ts * enable conferencing apps for teams initial commit * fix: make conferencing atom work with teams * update team events in bulk update default location * feat: Separate endpoints for team conferencing apps instead of query params * Display all team events in 'Bulk update existing event types' modal when conferencing atom is enabled for Teams * fix: bulk update default location for team events * removed the organizations endpoints * Refactor: Separate functions for team events to follow SRP * undo extra changes * undo extra changes * fix: platform libraries build breaking * feat: only allow integrations which are installed in create/update team/user event-type endpoints * fix: merge conflicts * remove redundant imports * Update ConferencingAppsViewPlatformWrapper.tsx * Update useBanners.ts * fix: axios error response interceptor * feat: update :app param docs in `organizations-conferencing.controller` * Revert "fix: axios error response interceptor" This reverts commit 729eac3eee9f81c19b5368bbae4b1666884221fd. * Update useAtomsGetInstalledConferencingApps.ts * upgrade platform libraries * Update apps.ts --------- Co-authored-by: Morgan <[email protected]> Co-authored-by: Morgan Vernay <[email protected]>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
|
|
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
|
import type { ApiSuccessResponse } from "@calcom/platform-types";
|
|
import type { ApiResponse } from "@calcom/platform-types";
|
|
|
|
import { useAtomsContext } from "../../../hooks/useAtomsContext";
|
|
import http from "../../../lib/http";
|
|
|
|
export const QUERY_KEY = "use-get-default-conferencing-app";
|
|
|
|
type ResponseDataType =
|
|
| {
|
|
appSlug?: string;
|
|
appLink?: string;
|
|
}
|
|
| undefined;
|
|
export const useGetDefaultConferencingApp = (teamId?: number) => {
|
|
const { isInit, accessToken, organizationId } = useAtomsContext();
|
|
|
|
let pathname = `/conferencing/default`;
|
|
|
|
if (teamId) {
|
|
pathname = `/organizations/${organizationId}/teams/${teamId}/conferencing/default`;
|
|
}
|
|
|
|
return useQuery({
|
|
queryKey: [QUERY_KEY, teamId, organizationId],
|
|
queryFn: () => {
|
|
return http?.get<ApiResponse<ResponseDataType>>(pathname).then((res) => {
|
|
if (res.data.status === SUCCESS_STATUS) {
|
|
return (res.data as ApiSuccessResponse<ResponseDataType>).data;
|
|
}
|
|
throw new Error(res.data.error.message);
|
|
});
|
|
},
|
|
enabled: isInit && !!accessToken,
|
|
});
|
|
};
|