feat: add env var for signup flow

This commit is contained in:
Chuma McPhoy
2024-11-04 15:55:49 +01:00
parent 452ad7bcd4
commit fd6c15ed78
4 changed files with 31 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
import { headers } from "next/headers"
import { notFound } from "next/navigation"
import { isSignupPage } from "@/constants/routes/signup"
import { env } from "@/env/server"
import HotelPage from "@/components/ContentType/HotelPage"
@@ -22,17 +24,24 @@ export default function ContentTypePage({
}: PageArgs<LangParams & ContentTypeParams & UIDParams, {}>) {
setLang(params.lang)
const pathname = headers().get("x-pathname") || ""
const isSignupRoute = isSignupPage(pathname)
switch (params.contentType) {
case "collection-page":
if (env.HIDE_FOR_NEXT_RELEASE) {
return notFound()
}
return <CollectionPage />
case "content-page":
if (env.HIDE_FOR_NEXT_RELEASE) {
case "content-page": {
if (!isSignupRoute && env.HIDE_FOR_NEXT_RELEASE) {
return notFound()
}
if (isSignupRoute && !env.SHOW_SIGNUP_FLOW) {
return notFound()
}
return <ContentPage />
}
case "loyalty-page":
return <LoyaltyPage />
case "hotel-page":