Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 4271 Rev 4945
Línea 2... Línea 2...
2
import React, { useEffect } from 'react'
2
import React, { useEffect } from 'react'
3
import { useDispatch, useSelector } from 'react-redux'
3
import { useDispatch, useSelector } from 'react-redux'
4
import { fetchFeeds, setCurrentPage } from '../../../../redux/feed/feed.actions'
4
import { fetchFeeds, setCurrentPage } from '../../../../redux/feed/feed.actions'
5
import EmptySection from '../../../../shared/empty-section/EmptySection'
5
import EmptySection from '../../../../shared/empty-section/EmptySection'
6
import Spinner from '../../../../shared/loading-spinner/Spinner'
6
import Spinner from '../../../../shared/loading-spinner/Spinner'
7
import PaginationComponent from '../../../../shared/pagination/PaginationComponent'
-
 
8
import ShareModal from '../../../components/share-modal/ShareModal'
7
import ShareModal from '../../../components/share-modal/ShareModal'
-
 
8
const PaginationComponent = React.lazy(() => import('../../../../shared/pagination/PaginationComponent'))
9
import Feed from './Feed'
9
import Feed from './Feed'
Línea 10... Línea 10...
10
 
10
 
11
const FeedList = ({
11
const FeedList = ({
12
  feed = {},
12
  feed = {},
13
  image = ''
13
  image = ''
14
}) => {
-
 
15
 
14
}) => {
16
  const { allFeeds, timelineUrl, pages, currentPage, loading } = useSelector((state) => state.feed)
15
  const { allFeeds, timelineUrl, pages, currentPage, loading } = useSelector((state) => state.feed)
Línea 17... Línea -...
17
  const dispatch = useDispatch()
-
 
18
 
16
  const dispatch = useDispatch()
Línea 19... Línea 17...
19
 
17
 
20
  const fetchSpecificFeed = () => dispatch(fetchFeeds(timelineUrl + '/feed/' + feed, 1))
18
  const fetchSpecificFeed = () => dispatch(fetchFeeds(timelineUrl + '/feed/' + feed, 1))
21
 
19
 
22
  useEffect(() => {
20
  useEffect(() => {
23
    if (feed) {
21
    if (feed) {
24
      return fetchSpecificFeed()
22
      return fetchSpecificFeed()
25
    } else {
23
    } else {
Línea 26... Línea -...
26
      return dispatch(fetchFeeds(timelineUrl, currentPage))
-
 
27
    }
24
      return dispatch(fetchFeeds(timelineUrl, currentPage))
28
  }, []);
25
    }
29
 
26
  }, []);
30
 
27
 
31
  const onChangePageHandler = (currentPage) => {
28
  const onChangePageHandler = (currentPage) => {
Línea 51... Línea 48...
51
            image={image}
48
            image={image}
52
            {...feed}
49
            {...feed}
53
          />
50
          />
54
        )
51
        )
55
      })}
52
      })}
-
 
53
      <React.Suspense fallback={null}>
56
      <PaginationComponent
54
        <PaginationComponent
57
        onChangePage={onChangePageHandler}
55
          onChangePage={onChangePageHandler}
58
        pages={pages}
56
          pages={pages}
59
        isRow
57
          isRow
60
        currentActivePage={currentPage}
58
          currentActivePage={currentPage}
61
      />
59
        />
-
 
60
      </React.Suspense>
62
      <ShareModal
61
      <ShareModal
63
        timelineUrl={timelineUrl}
62
        timelineUrl={timelineUrl}
64
        currentPage={currentPage}
63
        currentPage={currentPage}
65
      />
64
      />
66
    </>
65
    </>