only use event api v2 call if route is in env (#21680)
This commit is contained in:
1 parent
36a712f979
commit
c2240f0bad
1 file changed
+6
-1
@@ -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: {
|
||||
|
||||
Reference in new issue
Block a user