Rev 3416 | Rev 3694 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React from 'react'
import { useSelector } from 'react-redux'
import { Search } from '@mui/icons-material'
import { debounce } from '@utils'
import { useFetch, useSearchQuery } from '@hooks'
import Input from '@components/UI/inputs/Input'
import TitleSection from '@components/UI/TitleSection'
import MyConnectionsList from '@components/connections/MyConnectionsList'
import Pagination from '@components/common/Pagination'
const MyConnectionsPage = () => {
const labels = useSelector(({ intl }) => intl.labels)
const { getStringParams, setParam } = useSearchQuery()
const { data, isLoading, refetch } = useFetch(
`/connection/my-connections${getStringParams()}`
)
const handleSearch = debounce((e) => setParam('search', e.target.value))
return (
<>
<TitleSection title={labels.first_level_persons} />
<Input icon={<Search />} onChange={handleSearch} variant='search' />
<MyConnectionsList
connections={data.current?.items}
loading={isLoading}
onComplete={refetch}
/>
<Pagination
pages={data.total?.pages}
page={data.current?.page}
onChange={(page) => setParam('page', page)}
/>
</>
)
}
export default MyConnectionsPage