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"
|
import type { LangParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
export async function generateMetadata(props: PageArgs<LangParams>) {
|
export async function generateMetadata(props: PageArgs<LangParams>) {
|
||||||
const params = await props.params;
|
const params = await props.params
|
||||||
return {
|
return {
|
||||||
robots: {
|
robots: {
|
||||||
index: env.isLangLive(params.lang),
|
index: env.isLangLive(params.lang),
|
||||||
@@ -1,23 +1,18 @@
|
|||||||
import { headers } from "next/headers"
|
import { headers } from "next/headers"
|
||||||
import { notFound, redirect } from "next/navigation"
|
import { redirect } from "next/navigation"
|
||||||
|
|
||||||
import { getProfile } from "@/lib/trpc/memoizedRequests"
|
import { getProfile } from "@/lib/trpc/memoizedRequests"
|
||||||
|
|
||||||
import AccountPage from "@/components/Webviews/AccountPage"
|
|
||||||
import LoyaltyPage from "@/components/Webviews/LoyaltyPage"
|
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
|
|
||||||
import type {
|
import type { LangParams, LayoutArgs } from "@/types/params"
|
||||||
ContentTypeWebviewParams,
|
|
||||||
LangParams,
|
|
||||||
PageArgs,
|
|
||||||
UIDParams,
|
|
||||||
} from "@/types/params"
|
|
||||||
|
|
||||||
export default async function ContentTypePage(
|
export default async function Layout(
|
||||||
props: PageArgs<LangParams & ContentTypeWebviewParams & UIDParams, {}>
|
props: React.PropsWithChildren<LayoutArgs<LangParams>>
|
||||||
) {
|
) {
|
||||||
const params = await props.params
|
const params = await props.params
|
||||||
|
|
||||||
|
const { children } = props
|
||||||
const intl = await getIntl()
|
const intl = await getIntl()
|
||||||
const user = await getProfile()
|
const user = await getProfile()
|
||||||
|
|
||||||
@@ -64,14 +59,5 @@ export default async function ContentTypePage(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (params.contentType) {
|
return <>{children}</>
|
||||||
case "loyalty-page":
|
|
||||||
return <LoyaltyPage />
|
|
||||||
case "account-page":
|
|
||||||
return <AccountPage />
|
|
||||||
default:
|
|
||||||
const type: never = params.contentType
|
|
||||||
console.error(`Unsupported content type given: ${type}`)
|
|
||||||
notFound()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user