feat(WEB-127): add trpc to handle requests both serverside and clientside

This commit is contained in:
Simon Emanuelsson
2024-03-20 16:39:11 +01:00
parent 2087ac6c91
commit ec4da5798b
31 changed files with 422 additions and 40 deletions

View File

@@ -1,5 +1,10 @@
import { SessionProvider } from "next-auth/react"
import { auth } from "@/auth"
import AdobeScript from "@/components/Current/AdobeScript"
import Script from "next/script"
import TrpcProvider from "@/lib/trpc/Provider"
import VwoScript from "@/components/Current/VwoScript"
import type { Metadata } from "next"
@@ -12,10 +17,11 @@ export const metadata: Metadata = {
title: "Scandic Hotels New Web",
}
export default function RootLayout({
export default async function RootLayout({
children,
params,
}: React.PropsWithChildren<LayoutArgs<LangParams>>) {
const session = await auth()
return (
<html lang={params.lang}>
<head>
@@ -38,7 +44,9 @@ export default function RootLayout({
<VwoScript />
</head>
<body>
{children}
<SessionProvider session={session}>
<TrpcProvider>{children}</TrpcProvider>
</SessionProvider>
<Script id="page-tracking">{`
typeof _satellite !== "undefined" && _satellite.pageBottom();
`}</Script>