Merged in feat/SW-3540-fix-hotel-details-link-to-go- (pull request #2959)
feat SW-3540 Fixed route for hotel details link in sidepeek Approved-by: Anton Gunnarsson
This commit is contained in:
12
packages/booking-flow/lib/utils/routeToScandicWebUrl.ts
Normal file
12
packages/booking-flow/lib/utils/routeToScandicWebUrl.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user