Skip to content

Commit c2240f0

Browse files
authored
only use event api v2 call if route is in env (calcom#21680)
1 parent 36a712f commit c2240f0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ const paramsSchema = z.object({
2121
slug: z.string().transform((s) => slugify(s)),
2222
});
2323

24+
function hasApiV2RouteInEnv() {
25+
return Boolean(process.env.NEXT_PUBLIC_API_V2_URL);
26+
}
27+
2428
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
2529
const { req, params, query } = context;
2630
const session = await getServerSession({ req });
@@ -115,7 +119,8 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
115119
const allowSEOIndexing = organizationSettings?.allowSEOIndexing ?? false;
116120

117121
const featureRepo = new FeaturesRepository();
118-
const useApiV2 = await featureRepo.checkIfTeamHasFeature(team.id, "use-api-v2-for-team-slots");
122+
const teamHasApiV2Route = await featureRepo.checkIfTeamHasFeature(team.id, "use-api-v2-for-team-slots");
123+
const useApiV2 = teamHasApiV2Route && hasApiV2RouteInEnv();
119124

120125
return {
121126
props: {

0 commit comments

Comments
 (0)