Fix Bookings API payload extraction to handle data wrapper
This commit is contained in:
@@ -43,7 +43,8 @@ const getHeaders = () => {
|
|||||||
async function apiFetchBookings() {
|
async function apiFetchBookings() {
|
||||||
const res = await fetch(`${API_BASE}/admin/bookings`, { headers: getHeaders() });
|
const res = await fetch(`${API_BASE}/admin/bookings`, { headers: getHeaders() });
|
||||||
if (!res.ok) throw new Error('Failed to fetch bookings');
|
if (!res.ok) throw new Error('Failed to fetch bookings');
|
||||||
return res.json();
|
const json = await res.json();
|
||||||
|
return Array.isArray(json) ? json : (json.data || []);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function apiFetchSurveys() {
|
async function apiFetchSurveys() {
|
||||||
|
|||||||
Reference in New Issue
Block a user