Merged in feat/LOY-116-remove-cta-from-signup-verify-page (pull request #1335)
refactor(LOY-116): consolidate signup auth & remove SignUpVerification component * refactor(LOY-116): simplify signup authentication and remove SignUpVerification component - Remove SignUpVerification component and its related files - Move authentication checks to page-level components - Consolidate signup flow authentication logic - Remove unused signup verification link variant * refactor(LOY-116): remove "sign up verification" from TrackingPosition type Approved-by: Christian Andolf
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { headers } from "next/headers"
|
||||
import { notFound } from "next/navigation"
|
||||
import { notFound,redirect } from "next/navigation"
|
||||
|
||||
import { overview } from "@/constants/routes/myPages"
|
||||
import { isSignupPage } from "@/constants/routes/signup"
|
||||
import { env } from "@/env/server"
|
||||
import { getHotelPage } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import { auth } from "@/auth"
|
||||
import DestinationOverviewPage from "@/components/ContentType/DestinationOverviewPage"
|
||||
import DestinationCityPage from "@/components/ContentType/DestinationPage/DestinationCityPage"
|
||||
import DestinationCountryPage from "@/components/ContentType/DestinationPage/DestinationCountryPage"
|
||||
@@ -14,7 +16,8 @@ import LoyaltyPage from "@/components/ContentType/LoyaltyPage"
|
||||
import StartPage from "@/components/ContentType/StartPage"
|
||||
import CollectionPage from "@/components/ContentType/StaticPages/CollectionPage"
|
||||
import ContentPage from "@/components/ContentType/StaticPages/ContentPage"
|
||||
import { setLang } from "@/i18n/serverContext"
|
||||
import { getLang,setLang } from "@/i18n/serverContext"
|
||||
import { isValidSession } from "@/utils/session"
|
||||
|
||||
import type {
|
||||
ContentTypeParams,
|
||||
@@ -38,12 +41,17 @@ export default async function ContentTypePage({
|
||||
case PageContentTypeEnum.collectionPage:
|
||||
return <CollectionPage />
|
||||
case PageContentTypeEnum.contentPage: {
|
||||
// Hide content pages for signup routes when signup flow is disabled.
|
||||
if (!env.SHOW_SIGNUP_FLOW) {
|
||||
const isSignupRoute = isSignupPage(pathname)
|
||||
if (isSignupRoute) {
|
||||
const isSignupRoute = isSignupPage(pathname)
|
||||
|
||||
if (isSignupRoute) {
|
||||
if (!env.SHOW_SIGNUP_FLOW) {
|
||||
return notFound()
|
||||
}
|
||||
|
||||
const session = await auth()
|
||||
if (isValidSession(session)) {
|
||||
redirect(overview[getLang()])
|
||||
}
|
||||
}
|
||||
|
||||
return <ContentPage />
|
||||
|
||||
Reference in New Issue
Block a user