updates
This commit is contained in:
@@ -7,7 +7,7 @@ export interface BookingData {
|
||||
check_out_date: string; // YYYY-MM-DD
|
||||
guest_count: number;
|
||||
notes?: string;
|
||||
payment_method: 'cash' | 'stripe';
|
||||
payment_method: 'cash' | 'stripe' | 'paypal';
|
||||
total_price: number;
|
||||
guest_info: {
|
||||
full_name: string;
|
||||
@@ -35,7 +35,7 @@ export interface Booking {
|
||||
| 'cancelled'
|
||||
| 'checked_in'
|
||||
| 'checked_out';
|
||||
payment_method: 'cash' | 'stripe';
|
||||
payment_method: 'cash' | 'stripe' | 'paypal';
|
||||
payment_status:
|
||||
| 'unpaid'
|
||||
| 'paid'
|
||||
@@ -233,16 +233,27 @@ export const checkRoomAvailability = async (
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// Handle new response format when roomId is provided
|
||||
if (response.data?.data?.available !== undefined) {
|
||||
return {
|
||||
available: response.data.data.available,
|
||||
message: response.data.data.message,
|
||||
};
|
||||
}
|
||||
|
||||
// Fallback for old format
|
||||
return {
|
||||
available: true,
|
||||
message: response.data.message,
|
||||
message: response.data?.message || 'Room is available',
|
||||
};
|
||||
} catch (error: any) {
|
||||
if (error.response?.status === 409) {
|
||||
if (error.response?.status === 409 || error.response?.status === 404) {
|
||||
return {
|
||||
available: false,
|
||||
message:
|
||||
error.response.data.message ||
|
||||
error.response.data?.message ||
|
||||
error.response.data?.detail ||
|
||||
'Room already booked during this time',
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user