Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2870 | Rev 2873 | 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, useSearchParams } from '@hooks'

import Input from '@components/UI/inputs/Input'
import TitleSection from '@components/UI/TitleSection'
import CompaniesIFollowList from '@components/company/CompaniesIFollowList'

export default function CompaniesIFollowPage() {
  const labels = useSelector(({ intl }) => intl.labels)

  const { setParams, getParam } = useSearchParams()
  const {
    data: companies,
    isLoading,
    refetch
  } = useFetch('/company/following-companies?search=' + getParam('search'))

  const handleSearch = debounce((e) => setParams('search', e.target.value), 500)

  return (
    <>
      <TitleSection title={labels.companies_i_follow} />
      <Input icon={<Search />} onChange={handleSearch} />
      <CompaniesIFollowList
        companies={companies}
        loading={isLoading}
        onComplete={refetch}
      />
    </>
  )
}