feat SW-3540 Fixed route for hotel details link in sidepeek Approved-by: Anton Gunnarsson
13 lines
355 B
TypeScript
13 lines
355 B
TypeScript
export function routeToScandicWebUrl(url: string) {
|
|
const scandicWebUrl = `https://www.scandichotels.com`
|
|
let updatedUrl = url
|
|
if (/^(https?:)?\/\//i.test(url)) {
|
|
const parsedUrl = new URL(url)
|
|
parsedUrl.host = "www.scandichotels.com"
|
|
updatedUrl = parsedUrl.href
|
|
} else {
|
|
updatedUrl = scandicWebUrl + url
|
|
}
|
|
return updatedUrl
|
|
}
|