fix(SW-1710): use access object references instead

correct incorrect test that granted access incorrectly
This commit is contained in:
Christian Andolf
2025-03-07 14:22:33 +01:00
parent b0df70e552
commit af08b3277d
4 changed files with 24 additions and 14 deletions

View File

@@ -47,12 +47,11 @@ export async function MyStay({ refId }: { refId: string }) {
const { booking, hotel, room } = bookingConfirmation
const user = await getProfileSafely()
const cookie = cookies()
const bv = cookie.get("bv")?.value
const bv = cookies().get("bv")?.value
const intl = await getIntl()
const access = accessBooking(booking.guest, lastName, user, bv)
if (access.status === ACCESS_GRANTED.status) {
if (access === ACCESS_GRANTED) {
const linkedBookingPromises = booking.linkedReservations
? booking.linkedReservations.map((linkedBooking) => {
return getBookingConfirmation(linkedBooking.confirmationNumber)
@@ -122,7 +121,7 @@ export async function MyStay({ refId }: { refId: string }) {
)
}
if (access.status === ERROR_BAD_REQUEST.status) {
if (access === ERROR_BAD_REQUEST) {
return (
<main className={styles.main}>
<div className={styles.form}>
@@ -135,7 +134,7 @@ export async function MyStay({ refId }: { refId: string }) {
)
}
if (access.status === ERROR_UNAUTHORIZED.status) {
if (access === ERROR_UNAUTHORIZED) {
return (
<main className={styles.main}>
<div className={styles.logIn}>