Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 1186 Rev 1188
Línea 62... Línea 62...
62
    history.replace(`${pathname}?${params.toString()}`)
62
    history.replace(`${pathname}?${params.toString()}`)
63
  }
63
  }
Línea 64... Línea 64...
64
 
64
 
65
  useEffect(() => {
65
  useEffect(() => {
-
 
66
    const searchEntities = async () => {
66
    const searchEntities = async () => {
67
      setLoading(true)
67
      try {
-
 
68
        const date = new Date().getTime()
68
      try {
69
        const { data: responseData } = await axios.get(
69
        const { data: responseData } = await axios.get(
70
          `search/entity/group?page=1&t${date}`
70
          `${pathname}?${params.toString()}`
71
        )
71
        )
Línea 72... Línea 72...
72
        const { success, data } = responseData
72
        const { success, data } = responseData
73
 
73
 
74
        if (!success) {
74
        if (!success) {
Línea 75... Línea -...
75
          throw new Error(data)
-
 
76
        }
75
          throw new Error(data)
77
 
76
        }
78
        console.log(data)
77
 
79
        setEntities(data.current.items)
78
        setEntities(data.current.items)
-
 
79
        setPages(data.total.pages)
-
 
80
      } catch (error) {
80
        setPages(data.total.pages)
81
        dispatch(addNotification({ style: 'danger', msg: error.message }))
81
      } catch (error) {
82
      } finally {
Línea 82... Línea 83...
82
        dispatch(addNotification({ style: 'danger', msg: error.message }))
83
        setLoading(false)
83
      }
84
      }
Línea 84... Línea 85...
84
    }
85
    }
85
 
86
 
86
    searchEntities()
87
    searchEntities()
87
  }, [])
88
  }, [search, pathname])
Línea 108... Línea 109...
108
            </FiltersSidebar>
109
            </FiltersSidebar>
109
          </Grid>
110
          </Grid>
Línea 110... Línea 111...
110
 
111
 
111
          <Grid item xs={12} md={8} display='flex' direction='column' gap={2}>
112
          <Grid item xs={12} md={8} display='flex' direction='column' gap={2}>
-
 
113
            <div className='posts-section'>
-
 
114
              {loading ? (
-
 
115
                <LoaderContainer>
-
 
116
                  <Spinner />
-
 
117
                </LoaderContainer>
-
 
118
              ) : (
112
            <div className='posts-section'>
119
                <>
113
              <EntitiesList entities={entities} />
120
                  <EntitiesList entities={entities} />
114
              <PaginationComponent
121
                  <PaginationComponent
115
                pages={pages}
122
                    pages={pages}
116
                currentActivePage={currentPage}
123
                    currentActivePage={currentPage}
117
                onChangePage={onChangePage}
124
                    onChangePage={onChangePage}
-
 
125
                    isRow
-
 
126
                  />
118
                isRow
127
                </>
119
              />
128
              )}
120
            </div>
129
            </div>
121
          </Grid>
130
          </Grid>
122
        </Grid>
131
        </Grid>
123
      </Container>
132
      </Container>