aboutsummaryrefslogtreecommitdiff
path: root/src/pages/FeedPage/FeedPage.tsx
blob: b7d719e72d1a6afae353fccc7b7bb21ae5fd58e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import React, { useState, useEffect } from 'react';
import { Poll } from 'which-types';

import Feed from '../../components/Feed/Feed';
import { get } from '../../requests';

interface PropTypes {
  navigate: (prefix: string, id: string) => void;
}

const FeedPage: React.FC<PropTypes> = ({ navigate }) => {
  const [polls, setPolls] = useState<Poll[]>([]);

  useEffect(() => {
    get('/feed').then(response => {
      setPolls(response.data);
    });
  }, []);

  return <Feed polls={polls} navigate={navigate} />;
};

export default FeedPage;