pagination

This commit is contained in:
hamid zarghami
2025-05-12 11:43:48 +03:30
parent 052280a009
commit cad29d587c
16 changed files with 90 additions and 33 deletions
+10 -2
View File
@@ -1,4 +1,4 @@
import { FC } from 'react'
import { FC, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Button from '../../components/Button'
import { Add, Eye } from 'iconsax-react'
@@ -10,11 +10,13 @@ import { Pages } from '../../config/Pages'
import { useGetCustomers } from './hooks/useCustomerData'
import PageLoading from '../../components/PageLoading'
import { CustomerItemType } from './types/CustomerTypes'
import Pagination from '../../components/Pagination'
const CustomerList: FC = () => {
const { t } = useTranslation('global')
const getCustomers = useGetCustomers()
const [page, setPage] = useState(1)
const getCustomers = useGetCustomers(page)
return (
<div className='mt-4'>
@@ -117,6 +119,12 @@ const CustomerList: FC = () => {
</tbody>
</table>
<Pagination
totalPages={getCustomers.data?.data?.pager?.totalPages}
currentPage={page}
onPageChange={setPage}
/>
</div>
}
</div>