File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ const room = ref<RoomDTO | null>(null);
1717const roomAvailability = ref <RoomAvailabilityListDTO | null >(null );
1818const auth = useAuthStore ();
1919const loading = ref (false );
20+ const error = ref (' ' );
2021
2122onMounted (() => { auth .checkLocalStorage (); });
2223onMounted (() => loadRoom ());
@@ -29,6 +30,7 @@ const loadRoom = () => {
2930 RoomAPI .findById (roomId ).then ((res : AxiosResponse <RoomDTO >) => {
3031 room .value = res .data ;
3132 }).catch ((err : AxiosError ) => {
33+ error .value = (err .response ?.data as { error: string })?.error ?? " An unknown error occurred." ;
3234 console .error (err );
3335 }).finally (() => {
3436 loading .value = false ;
@@ -58,6 +60,9 @@ const gotoReservation = () => {
5860 <div v-if =" loading" >
5961 <ProgressBar mode="indeterminate" style =" height : 6px " ></ProgressBar >
6062 </div >
63+
64+ <Message v-show =" error .length > 0 " style =" margin : 7px ;" severity="error" size="medium" variant="simple">{{ error }}</Message >
65+
6166 <div v-if =" room" >
6267 <h2 >{{ room.name }}</h2 >
6368 <p >{{ room.description }}</p >
You can’t perform that action at this time.
0 commit comments