From 29e81d99950f460548b8cd98b401b73909a794df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matilda=20Landstr=C3=B6m?= Date: Mon, 24 Nov 2025 10:14:57 +0000 Subject: [PATCH] Merged in fix/LOY-483-only-english (pull request #3194) Fix/LOY-483: Fix My Pages working in all languages * fix(LOY-483): add back specific handling of profile pages * fix(LOY-483): remove limit of 1 profiling consent config Approved-by: Chuma Mcphoy (We Ahead) --- apps/scandic-web/middlewares/myPages.ts | 29 +++++++++++++++++++ .../graphql/Query/ProfilingConsent.graphql.ts | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) 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 {