File tree Expand file tree Collapse file tree
apps/web/lib/team/[slug]/[type] Expand file tree Collapse file tree Original file line number Diff line number Diff 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+
2428export 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 : {
You can’t perform that action at this time.
0 commit comments