Fix Bookings API payload extraction to handle data wrapper

This commit is contained in:
2026-06-22 18:09:07 +05:30
parent 310363347e
commit e8949e0b1a

View File

@@ -43,7 +43,8 @@ const getHeaders = () => {
async function apiFetchBookings() {
const res = await fetch(`${API_BASE}/admin/bookings`, { headers: getHeaders() });
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() {