Merged in fix/STAY-17-find-my-booking-errors (pull request #3181)
fix: improve error messages in find my booking flow * fix: improve error messages in find my booking flow Approved-by: Linus Flood Approved-by: Erik Tiekstra
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import type { IntlShape } from "react-intl"
|
||||
|
||||
export enum FindMyBookingErrorEnum {
|
||||
BOOKING_NOT_FOUND = "BOOKING_NOT_FOUND",
|
||||
BOOKING_ACCESS_DENIED = "BOOKING_ACCESS_DENIED",
|
||||
}
|
||||
|
||||
export function getErrorMessage(
|
||||
intl: IntlShape,
|
||||
error?: FindMyBookingErrorEnum
|
||||
) {
|
||||
switch (error) {
|
||||
case FindMyBookingErrorEnum.BOOKING_ACCESS_DENIED:
|
||||
return {
|
||||
heading: intl.formatMessage({
|
||||
id: "myStay.accessDenied.loginRequired",
|
||||
defaultMessage: "You need to be logged in to view your booking",
|
||||
}),
|
||||
text: intl.formatMessage({
|
||||
id: "myStay.accessDenied.loginRequiredMessage",
|
||||
defaultMessage:
|
||||
"And you need to be logged in with the same member account that made the booking.",
|
||||
}),
|
||||
}
|
||||
case FindMyBookingErrorEnum.BOOKING_NOT_FOUND:
|
||||
return {
|
||||
heading: intl.formatMessage({
|
||||
id: "myStay.accessDenied.bookingNotFound",
|
||||
defaultMessage: "We couldn't find your booking",
|
||||
}),
|
||||
text: intl.formatMessage({
|
||||
id: "myStay.accessDenied.bookingNotFoundMessage",
|
||||
defaultMessage:
|
||||
"Please make sure you have entered the correct booking details and try again.",
|
||||
}),
|
||||
}
|
||||
default:
|
||||
return null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user