Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1191 | Rev 1193 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1191 Rev 1192
Línea 24... Línea 24...
24
  const { category } = useParams()
24
  const { category } = useParams()
25
  const addressRef = useRef({})
25
  const addressRef = useRef({})
26
  const history = useHistory()
26
  const history = useHistory()
27
  const labels = useSelector(({ intl }) => intl.labels)
27
  const labels = useSelector(({ intl }) => intl.labels)
28
  const dispatch = useDispatch()
28
  const dispatch = useDispatch()
29
  const params = new URLSearchParams(search)
-
 
Línea 30... Línea 29...
30
 
29
 
-
 
30
  const onChangeKeyword = debounce((value = '') => {
31
  const onChangeKeyword = debounce((value = '') => {
31
    const params = new URLSearchParams(search)
32
    params.set('page', '1')
32
    params.set('page', '1')
33
    params.set('keyword', value)
33
    params.set('keyword', value)
34
    history.replace(`${pathname}?${params.toString()}`)
34
    history.replace(`${pathname}?${params.toString()}`)
Línea 35... Línea 35...
35
  }, 500)
35
  }, 500)
-
 
36
 
36
 
37
  const onChangePage = (currentPage = 1) => {
37
  const onChangePage = (currentPage = 1) => {
38
    const params = new URLSearchParams(search)
38
    params.set('page', `${currentPage}`)
39
    params.set('page', `${currentPage}`)
Línea 39... Línea 40...
39
    history.replace(`${pathname}?${params.toString()}`)
40
    history.replace(`${pathname}?${params.toString()}`)
-
 
41
  }
40
  }
42
 
41
 
43
  const onChangeCategory = (newCategory = 'user') => {
42
  const onChangeCategory = (newCategory = 'user') => {
44
    const params = new URLSearchParams(search)
Línea 43... Línea 45...
43
    params.set('page', '1')
45
    params.set('page', '1')
-
 
46
    history.replace(`/search/entity/${newCategory}?${params.toString()}`)
44
    history.replace(`/search/entity/${newCategory}?${params.toString()}`)
47
  }
45
  }
48
 
46
 
49
  const onChangeAddress = (address = {}) => {
47
  const onChangeAddress = (address = {}) => {
50
    const params = new URLSearchParams(search)
Línea 58... Línea 61...
58
 
61
 
59
    history.replace(`${pathname}?${params.toString()}`)
62
    history.replace(`${pathname}?${params.toString()}`)
Línea 60... Línea 63...
60
  }
63
  }
-
 
64
 
-
 
65
  useEffect(() => {
61
 
66
    console.log(search)
62
  useEffect(() => {
67
 
63
    const searchEntities = async () => {
68
    const searchEntities = async () => {
64
      setLoading(true)
69
      setLoading(true)
65
      try {
-
 
66
        const { data: responseData } = await axios.get(
-
 
67
          `${pathname}?${params.toString()}`
70
      try {
Línea 68... Línea 71...
68
        )
71
        const { data: responseData } = await axios.get(`${pathname}`)
69
        const { success, data } = responseData
72
        const { success, data } = responseData
70
 
73
 
Línea 88... Línea 91...
88
    <>
91
    <>
89
      <Container as='main'>
92
      <Container as='main'>
90
        <Input
93
        <Input
91
          icon={Search}
94
          icon={Search}
92
          onChange={(e) => onChangeKeyword(e.target.value)}
95
          onChange={(e) => onChangeKeyword(e.target.value)}
93
          defaultValue={params.get('keyword')}
-
 
94
          placeholder={labels.search}
96
          placeholder={labels.search}
95
        />
97
        />
Línea 96... Línea 98...
96
 
98
 
97
        <Grid container spacing={2} mt={2}>
99
        <Grid container spacing={2} mt={2}>
Línea 115... Línea 117...
115
              ) : (
117
              ) : (
116
                <>
118
                <>
117
                  <EntitiesList entities={entities} />
119
                  <EntitiesList entities={entities} />
118
                  <PaginationComponent
120
                  <PaginationComponent
119
                    pages={pages}
121
                    pages={pages}
120
                    currentActivePage={params.get('page') || 1}
-
 
121
                    onChangePage={onChangePage}
122
                    onChangePage={onChangePage}
122
                    isRow
123
                    isRow
123
                  />
124
                  />
124
                </>
125
                </>
125
              )}
126
              )}