Merged in fix/my-stay-webview-3 (pull request #2281)
feat/my-stay-webview - check if user else redirect to refresh page * feat/my-stay-webview - check if user else redirect to refresh page Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import AccountPage from "@/components/Webviews/AccountPage"
|
||||
import LoyaltyPage from "@/components/Webviews/LoyaltyPage"
|
||||
|
||||
import type {
|
||||
ContentTypeWebviewParams,
|
||||
LangParams,
|
||||
PageArgs,
|
||||
UIDParams,
|
||||
} from "@/types/params"
|
||||
|
||||
export default async function ContentTypePage(
|
||||
props: PageArgs<LangParams & ContentTypeWebviewParams & UIDParams, {}>
|
||||
) {
|
||||
const params = await props.params
|
||||
|
||||
switch (params.contentType) {
|
||||
case "loyalty-page":
|
||||
return <LoyaltyPage />
|
||||
case "account-page":
|
||||
return <AccountPage />
|
||||
default:
|
||||
const type: never = params.contentType
|
||||
console.error(`Unsupported content type given: ${type}`)
|
||||
notFound()
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import { env } from "@/env/server"
|
||||
import type { LangParams, PageArgs } from "@/types/params"
|
||||
|
||||
export async function generateMetadata(props: PageArgs<LangParams>) {
|
||||
const params = await props.params;
|
||||
const params = await props.params
|
||||
return {
|
||||
robots: {
|
||||
index: env.isLangLive(params.lang),
|
||||
@@ -1,23 +1,18 @@
|
||||
import { headers } from "next/headers"
|
||||
import { notFound, redirect } from "next/navigation"
|
||||
import { redirect } from "next/navigation"
|
||||
|
||||
import { getProfile } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import AccountPage from "@/components/Webviews/AccountPage"
|
||||
import LoyaltyPage from "@/components/Webviews/LoyaltyPage"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import type {
|
||||
ContentTypeWebviewParams,
|
||||
LangParams,
|
||||
PageArgs,
|
||||
UIDParams,
|
||||
} from "@/types/params"
|
||||
import type { LangParams, LayoutArgs } from "@/types/params"
|
||||
|
||||
export default async function ContentTypePage(
|
||||
props: PageArgs<LangParams & ContentTypeWebviewParams & UIDParams, {}>
|
||||
export default async function Layout(
|
||||
props: React.PropsWithChildren<LayoutArgs<LangParams>>
|
||||
) {
|
||||
const params = await props.params
|
||||
|
||||
const { children } = props
|
||||
const intl = await getIntl()
|
||||
const user = await getProfile()
|
||||
|
||||
@@ -64,14 +59,5 @@ export default async function ContentTypePage(
|
||||
}
|
||||
}
|
||||
|
||||
switch (params.contentType) {
|
||||
case "loyalty-page":
|
||||
return <LoyaltyPage />
|
||||
case "account-page":
|
||||
return <AccountPage />
|
||||
default:
|
||||
const type: never = params.contentType
|
||||
console.error(`Unsupported content type given: ${type}`)
|
||||
notFound()
|
||||
}
|
||||
return <>{children}</>
|
||||
}
|
||||
Reference in New Issue
Block a user