From 1f646377c35b65b97d6eeebb1e88f6d8307e1ef0 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Mon, 29 Jun 2020 23:59:15 +0300
Subject: feat!: create useAuth hook

---
 src/pages/FeedPage/FeedPage.tsx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'src/pages/FeedPage/FeedPage.tsx')

diff --git a/src/pages/FeedPage/FeedPage.tsx b/src/pages/FeedPage/FeedPage.tsx
index 0017275..6561991 100644
--- a/src/pages/FeedPage/FeedPage.tsx
+++ b/src/pages/FeedPage/FeedPage.tsx
@@ -4,15 +4,16 @@ import { Poll, User } from 'which-types';
 import Feed from '../../components/Feed/Feed';
 import { get } from '../../requests';
 import PollSubmission from './PollSubmission';
+import { useAuth } from '../../hooks/useAuth';
 
 
 interface PropTypes {
   navigate: (prefix: string, id: string) => void;
-  user: User | undefined;
 }
 
-const FeedPage: React.FC<PropTypes> = ({ navigate, user }) => {
+const FeedPage: React.FC<PropTypes> = ({ navigate }) => {
   const [polls, setPolls] = useState<Poll[]>([]);
+  const { isAuthenticated } = useAuth();
 
   useEffect(() => {
     get('/feed').then(response => {
@@ -28,7 +29,7 @@ const FeedPage: React.FC<PropTypes> = ({ navigate, user }) => {
 
   return (
     <>
-      {user && <PollSubmission user={user} addPoll={addPoll} />}
+      {isAuthenticated() && <PollSubmission addPoll={addPoll} />}
       <Feed polls={polls} navigate={navigate} />
     </>
   );
-- 
cgit v1.2.3


From 1499c0126d1a7a2377b0267b761479100c636ee9 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Tue, 30 Jun 2020 00:41:09 +0300
Subject: feat!: create useNavigate hook

---
 src/pages/FeedPage/FeedPage.tsx | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

(limited to 'src/pages/FeedPage/FeedPage.tsx')

diff --git a/src/pages/FeedPage/FeedPage.tsx b/src/pages/FeedPage/FeedPage.tsx
index 6561991..87a56ec 100644
--- a/src/pages/FeedPage/FeedPage.tsx
+++ b/src/pages/FeedPage/FeedPage.tsx
@@ -7,11 +7,7 @@ import PollSubmission from './PollSubmission';
 import { useAuth } from '../../hooks/useAuth';
 
 
-interface PropTypes {
-  navigate: (prefix: string, id: string) => void;
-}
-
-const FeedPage: React.FC<PropTypes> = ({ navigate }) => {
+const FeedPage: React.FC = () => {
   const [polls, setPolls] = useState<Poll[]>([]);
   const { isAuthenticated } = useAuth();
 
@@ -30,7 +26,7 @@ const FeedPage: React.FC<PropTypes> = ({ navigate }) => {
   return (
     <>
       {isAuthenticated() && <PollSubmission addPoll={addPoll} />}
-      <Feed polls={polls} navigate={navigate} />
+      <Feed polls={polls} />
     </>
   );
 };
-- 
cgit v1.2.3


From 5ccb1ec0be71ed4efb22b4942d70d9132415f69e Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Tue, 30 Jun 2020 00:43:48 +0300
Subject: style: fix some eslint errors

---
 src/pages/FeedPage/FeedPage.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/pages/FeedPage/FeedPage.tsx')

diff --git a/src/pages/FeedPage/FeedPage.tsx b/src/pages/FeedPage/FeedPage.tsx
index 87a56ec..d29103a 100644
--- a/src/pages/FeedPage/FeedPage.tsx
+++ b/src/pages/FeedPage/FeedPage.tsx
@@ -1,5 +1,5 @@
 import React, { useState, useEffect } from 'react';
-import { Poll, User } from 'which-types';
+import { Poll } from 'which-types';
 
 import Feed from '../../components/Feed/Feed';
 import { get } from '../../requests';
-- 
cgit v1.2.3

