Merged in fix/SA-1180-my-stay-crashing (pull request #3419)

fix(SA-1180): update url for manage booking

* fix(SA-1180): update url for manage booking


Approved-by: Matilda Haneling
Approved-by: Linus Flood
This commit is contained in:
Matilda Landström
2026-01-12 10:14:07 +00:00
parent 562ad28cac
commit f5875bffa7

View File

@@ -24,13 +24,14 @@ export default function AddToCalendarAction() {
hotel: state.hotel, hotel: state.hotel,
hotelUrl: state.hotelUrl, hotelUrl: state.hotelUrl,
})) }))
let baseUrl = typeof window !== "undefined" ? window.location.hostname : ""
if (baseUrl.includes("localhost") || !baseUrl) { let baseUrl =
typeof window !== "undefined" ? window.location.origin : undefined
if (!baseUrl || baseUrl.includes("localhost")) {
// Localhost not valid for calendar URL // Localhost not valid for calendar URL
baseUrl = "https://www.scandichotels.com" baseUrl = "https://www.scandichotels.com"
} }
const url = new URL(hotelUrl || "/", baseUrl)
const url = new URL(hotelUrl || "", baseUrl)
const calendarEvent: EventAttributes = { const calendarEvent: EventAttributes = {
busyStatus: "FREE", busyStatus: "FREE",