diff --git a/apps/scandic-web/middlewares/myPages.ts b/apps/scandic-web/middlewares/myPages.ts index a67511968..a62cd421a 100644 --- a/apps/scandic-web/middlewares/myPages.ts +++ b/apps/scandic-web/middlewares/myPages.ts @@ -3,6 +3,9 @@ import { type NextMiddleware, NextResponse } from "next/server" import { myPages, overview, + profile, + profileConsent, + profileEdit, } from "@scandic-hotels/common/constants/routes/myPages" import { logger } from "@scandic-hotels/common/logger" import { findLang } from "@scandic-hotels/common/utils/languages" @@ -49,6 +52,32 @@ export const middleware: NextMiddleware = async (request) => { headers.set("x-uid", uid) headers.set("x-contenttype", contentType) + if (profile[lang].startsWith(nextUrl.pathname)) { + return NextResponse.rewrite(new URL(`/${lang}/my-pages/profile`, nextUrl), { + request: { + headers, + }, + }) + } else if (profileEdit[lang].startsWith(nextUrl.pathname)) { + return NextResponse.rewrite( + new URL(`/${lang}/my-pages/profile/edit`, nextUrl), + { + request: { + headers, + }, + } + ) + } else if (profileConsent[lang].startsWith(nextUrl.pathname)) { + return NextResponse.rewrite( + new URL(`/${lang}/my-pages/profile/consent`, nextUrl), + { + request: { + headers, + }, + } + ) + } + return NextResponse.next({ request: { headers, diff --git a/packages/trpc/lib/graphql/Query/ProfilingConsent.graphql.ts b/packages/trpc/lib/graphql/Query/ProfilingConsent.graphql.ts index 7da926904..fe7d8ee28 100644 --- a/packages/trpc/lib/graphql/Query/ProfilingConsent.graphql.ts +++ b/packages/trpc/lib/graphql/Query/ProfilingConsent.graphql.ts @@ -2,7 +2,7 @@ import { gql } from "graphql-tag" export const GetProfilingConsent = gql` query GetProfilingConsent($locale: String!) { - all_profiling_consent(limit: 1, locale: $locale) { + all_profiling_consent(locale: $locale) { items { main_icon profiling_consent_banner {