error handeling on the pagination
This commit is contained in:
@@ -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 [];
|
||||
|
||||
Reference in New Issue
Block a user