fix(SW-890): better feature flag handling
This commit is contained in:
@@ -25,7 +25,6 @@ export default function ContentTypePage({
|
|||||||
setLang(params.lang)
|
setLang(params.lang)
|
||||||
|
|
||||||
const pathname = headers().get("x-pathname") || ""
|
const pathname = headers().get("x-pathname") || ""
|
||||||
const isSignupRoute = isSignupPage(pathname)
|
|
||||||
|
|
||||||
switch (params.contentType) {
|
switch (params.contentType) {
|
||||||
case "collection-page":
|
case "collection-page":
|
||||||
@@ -34,12 +33,22 @@ export default function ContentTypePage({
|
|||||||
}
|
}
|
||||||
return <CollectionPage />
|
return <CollectionPage />
|
||||||
case "content-page": {
|
case "content-page": {
|
||||||
if (!isSignupRoute && env.HIDE_FOR_NEXT_RELEASE) {
|
const isSignupRoute = isSignupPage(pathname)
|
||||||
|
|
||||||
|
if (env.HIDE_FOR_NEXT_RELEASE) {
|
||||||
|
// Hide content pages for next release for non-signup routes.
|
||||||
|
if (!isSignupRoute) {
|
||||||
return notFound()
|
return notFound()
|
||||||
}
|
}
|
||||||
if (isSignupRoute && !env.SHOW_SIGNUP_FLOW) {
|
}
|
||||||
|
|
||||||
|
if (!env.SHOW_SIGNUP_FLOW) {
|
||||||
|
// Hide content pages for signup routes when signup flow is disabled.
|
||||||
|
if (isSignupRoute) {
|
||||||
return notFound()
|
return notFound()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return <ContentPage />
|
return <ContentPage />
|
||||||
}
|
}
|
||||||
case "loyalty-page":
|
case "loyalty-page":
|
||||||
|
|||||||
@@ -20,10 +20,5 @@ export const signupVerify: LangRoute = {
|
|||||||
|
|
||||||
export function isSignupPage(path: string): boolean {
|
export function isSignupPage(path: string): boolean {
|
||||||
const signupPaths = [...Object.values(signup), ...Object.values(signupVerify)]
|
const signupPaths = [...Object.values(signup), ...Object.values(signupVerify)]
|
||||||
const result = signupPaths.some((signupPath) => {
|
return signupPaths.some((signupPath) => signupPath.includes(path))
|
||||||
const includes = signupPath.includes(path)
|
|
||||||
return includes
|
|
||||||
})
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user