Files
web/apps/scandic-web/utils/webviews.ts
Matilda Landström 5de2a993a7 Merged in feat/SW-1711-switch-icons (pull request #1558)
Switches out all the old icons to new ones, and moves them to the design system. The new icons are of three different types: Materialise Symbol, Nucleo, and Customized. Also adds further mapping between facilities/amenities and icons.

Approved-by: Michael Zetterberg
Approved-by: Erik Tiekstra
2025-03-27 09:42:52 +00:00

34 lines
903 B
TypeScript

import "server-only"
import { headers } from "next/headers"
import { webviews } from "@/constants/routes/webviews"
import type { Lang } from "@/constants/languages"
export function webviewSearchParams() {
const searchParams = new URLSearchParams()
const loginType = headers().get("loginType")
if (loginType) {
searchParams.set("loginType", loginType)
}
const adobeMc = headers().get("adobe_mc")
if (adobeMc) {
searchParams.set("adobe_mc", adobeMc)
}
return searchParams
}
export function modWebviewLink(url: string, lang: Lang) {
const searchParams = webviewSearchParams()
const urlWithoutLang = url.replace(`/${lang}`, "")
const webviewUrl = `/${lang}/webview${urlWithoutLang}`
if (webviews.includes(webviewUrl) || url.startsWith("/webview")) {
return `${webviewUrl}?${searchParams.toString()}`
} else {
return `${url}?${searchParams.toString()}`
}
}