error handeling on the pagination

This commit is contained in:
Arezoo
2025-10-22 17:38:29 +03:30
parent 74d142e86e
commit 34188ab366
9 changed files with 76 additions and 34 deletions
+4 -3
View File
@@ -16,9 +16,10 @@ export async function getClinicDoctors(slug, params = {}) {
}
const json = await response.json();
const doctorsList = json?.data || json || [];
return Array.isArray(doctorsList) ? doctorsList : [];
return {
data: json?.data || [],
page: json?.page || json?.pages || { total_pages: 1, current: 1 },
};
} catch (error) {
console.error("خطا در دریافت دکترهای کلینیک:", error);
return [];