Scheduling infrastructure for absolutely everyone.
only use event api v2 call if route is in env (#21680)
sean-brydonc2240f0bad71
diff --git a/apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx b/apps/web/lib/team/[slug]/[type]/getServerSideProps.tsxindex 5831f1bc36d..8564a4efcea 100644--- a/apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx+++ b/apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx@@ -21,6 +21,10 @@ const paramsSchema = z.object({slug: z.string().transform((s) => slugify(s)),});+function hasApiV2RouteInEnv() {+ return Boolean(process.env.NEXT_PUBLIC_API_V2_URL);+}+export const getServerSideProps = async (context: GetServerSidePropsContext) => {const { req, params, query } = context;const session = await getServerSession({ req });@@ -115,7 +119,8 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>const allowSEOIndexing = organizationSettings?.allowSEOIndexing ?? false;const featureRepo = new FeaturesRepository();- const useApiV2 = await featureRepo.checkIfTeamHasFeature(team.id, "use-api-v2-for-team-slots");+ const teamHasApiV2Route = await featureRepo.checkIfTeamHasFeature(team.id, "use-api-v2-for-team-slots");+ const useApiV2 = teamHasApiV2Route && hasApiV2RouteInEnv();return {props: {