feat(pagination): implement hybrid pagination across multiple components

- Introduced a new `useHybridPagination` hook to manage pagination logic, enhancing data fetching and navigation.
- Updated various components including `useAdminsPresenter`, `useCompanyListPresenter`, `useCustomerListPresenter`, and others to utilize the new pagination hook, improving code consistency and reducing duplication.
- Refactored pagination handling in each component to streamline state management and improve user experience during data navigation.
- Enhanced search functionality to reset pagination state when new search parameters are applied, ensuring accurate data display.
This commit is contained in:
AmirReza Jamali
2026-05-17 17:01:28 +03:30
parent a6bb481ab1
commit f4a425a6e5
12 changed files with 292 additions and 211 deletions
+7 -9
View File
@@ -1,26 +1,24 @@
import { z } from "zod";
const MetaDataSchema = z.object({
limit: z.number(),
offset: z.number(),
page: z.number(),
pages: z.number(),
total: z.number(),
has_more: z.boolean().optional(),
next_cursor: z.string().optional(),
prev_cursor: z.string().optional(),
});
export function createApiResponseSchema<T extends z.ZodTypeAny>(dataSchema: T) {
return z.object({
data: dataSchema,
meta: z
.object({
limit: z.number(),
offset: z.number(),
page: z.number(),
pages: z.number(),
total: z.number(),
})
.optional(),
meta: MetaDataSchema.optional(),
message: z.string(),
code: z.number().optional(),
success: z.boolean(),
});
}
export type IMetaData = z.infer<typeof MetaDataSchema>;