diff --git a/apps/scandic-web/components/Current/Header/MainMenu/index.tsx b/apps/scandic-web/components/Current/Header/MainMenu/index.tsx index fcff0dcf4..70066facf 100644 --- a/apps/scandic-web/components/Current/Header/MainMenu/index.tsx +++ b/apps/scandic-web/components/Current/Header/MainMenu/index.tsx @@ -2,7 +2,7 @@ import { usePathname } from "next/navigation" import { useIntl } from "react-intl" -import { findMyBooking } from "@/constants/myBooking" +import { findMyBooking } from "@/constants/routes/findMyBooking" import { logout } from "@/constants/routes/handleAuth" import { myPages } from "@/constants/routes/myPages" import useDropdownStore from "@/stores/main-menu" diff --git a/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx b/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx index 17872b396..9e5edfb9f 100644 --- a/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx +++ b/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx @@ -5,7 +5,7 @@ import { Dialog, Modal } from "react-aria-components" import { useIntl } from "react-intl" import { useMediaQuery } from "usehooks-ts" -import { findMyBooking } from "@/constants/myBooking" +import { findMyBooking } from "@/constants/routes/findMyBooking" import useDropdownStore from "@/stores/main-menu" import LanguageSwitcher from "@/components/LanguageSwitcher" diff --git a/apps/scandic-web/components/Header/TopMenu/index.tsx b/apps/scandic-web/components/Header/TopMenu/index.tsx index 133095db7..c88dd77e3 100644 --- a/apps/scandic-web/components/Header/TopMenu/index.tsx +++ b/apps/scandic-web/components/Header/TopMenu/index.tsx @@ -1,4 +1,4 @@ -import { findMyBooking } from "@/constants/myBooking" +import { findMyBooking } from "@/constants/routes/findMyBooking" import { getHeader } from "@/lib/trpc/memoizedRequests" import { auth } from "@/auth" diff --git a/apps/scandic-web/constants/myBooking.ts b/apps/scandic-web/constants/myBooking.ts index 4f67ffa10..2c7035c7b 100644 --- a/apps/scandic-web/constants/myBooking.ts +++ b/apps/scandic-web/constants/myBooking.ts @@ -24,12 +24,3 @@ export const myBooking = { sv: "https://test.scandichotels.se/hotelreservation/din-bokning", }, } - -export const findMyBooking = { - da: "/da/hotelreservation/hent-booking", - de: "/de/hotelreservation/mein-bereich", - en: "/en/hotelreservation/get-booking", - fi: "/fi/hotelreservation/hae-varaus", - no: "/no/hotelreservation/get-booking", - sv: "/sv/hotelreservation/hitta-bokning", -} diff --git a/apps/scandic-web/constants/routes/findMyBooking.js b/apps/scandic-web/constants/routes/findMyBooking.js new file mode 100644 index 000000000..a8b3f4568 --- /dev/null +++ b/apps/scandic-web/constants/routes/findMyBooking.js @@ -0,0 +1,14 @@ +/** + * @file Due to these records being used in next.config.js, and that is required + * to be a js file, we use jsdoc to type these. + */ + +/** @type {import('@/types/routes').LangRoute} */ +export const findMyBooking = { + da: "/da/hotelreservation/hent-booking", + de: "/de/hotelreservation/mein-bereich", + en: "/en/hotelreservation/get-booking", + fi: "/fi/hotelreservation/hae-varaus", + no: "/no/hotelreservation/get-booking", + sv: "/sv/hotelreservation/hitta-bokning", +} diff --git a/apps/scandic-web/next.config.js b/apps/scandic-web/next.config.js index b7040ace2..ebff44a71 100644 --- a/apps/scandic-web/next.config.js +++ b/apps/scandic-web/next.config.js @@ -2,6 +2,7 @@ import * as Sentry from "@sentry/nextjs" import createJiti from "jiti" import { fileURLToPath } from "url" +import { findMyBooking } from "./constants/routes/findMyBooking.js" import { login, logout } from "./constants/routes/handleAuth.js" import { myPages } from "./constants/routes/myPages.js" @@ -275,27 +276,27 @@ const nextConfig = { }, // Find my booking { - source: "/en/hotelreservation/get-booking", + source: findMyBooking.en, destination: "/en/hotelreservation/get-booking", }, { - source: "/no/hotelreservation/get-booking", - destination: "/no/hotelreservation/get-booking", - }, - { - source: "/da/hotelreservation/hent-booking", + source: findMyBooking.da, destination: "/da/hotelreservation/get-booking", }, { - source: "/de/hotelreservation/mein-bereich", + source: findMyBooking.de, destination: "/de/hotelreservation/get-booking", }, { - source: "/fi/hotelreservation/hae-varaus", + source: findMyBooking.fi, destination: "/fi/hotelreservation/get-booking", }, { - source: "/sv/hotelreservation/hitta-bokning", + source: findMyBooking.no, + destination: "/no/hotelreservation/get-booking", + }, + { + source: findMyBooking.sv, destination: "/sv/hotelreservation/get-booking", }, ], diff --git a/apps/scandic-web/server/routers/contentstack/languageSwitcher/query.ts b/apps/scandic-web/server/routers/contentstack/languageSwitcher/query.ts index f794576f5..003e3ac6e 100644 --- a/apps/scandic-web/server/routers/contentstack/languageSwitcher/query.ts +++ b/apps/scandic-web/server/routers/contentstack/languageSwitcher/query.ts @@ -1,8 +1,8 @@ import { metrics } from "@opentelemetry/api" import { Lang } from "@/constants/languages" -import { findMyBooking } from "@/constants/myBooking" import { baseUrls } from "@/constants/routes/baseUrls" +import { findMyBooking } from "@/constants/routes/findMyBooking" import { batchRequest } from "@/lib/graphql/batchRequest" import { GetDaDeEnUrlsAccountPage,