From af6c0b0730c6a2ab01771ce9091dff271cbd2dea Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Thu, 25 Jun 2020 22:26:03 +0300
Subject: hotfix/refactor: do not use extra deps in hook

---
 src/index.tsx | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'src/index.tsx')

diff --git a/src/index.tsx b/src/index.tsx
index a321cf4..2e0bfe7 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -72,15 +72,17 @@ const App: React.FC = () => {
     }).catch(() => false);
   };
 
-  const logOut = (redirect = true) => {
+  const logOut = () => {
     setUser(undefined);
     localStorage.removeItem('userId');
     localStorage.removeItem('token');
-    if (redirect) navigate('auth');
+    navigate('auth');
   };
 
   useEffect(() => {
-    if (localStorage.getItem('shouldClear')) logOut(false);
+    if (localStorage.getItem('shouldClear')) {
+      localStorage.clear();
+    }
     const userId = localStorage.getItem('userId');
     if (userId) {
       get(`/users/${userId}`).then(response => {
-- 
cgit v1.2.3

