aboutsummaryrefslogtreecommitdiff
path: root/src/index.tsx
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-06-25 22:26:03 +0300
committereug-vs <eug-vs@keemail.me>2020-06-25 22:28:49 +0300
commitaf6c0b0730c6a2ab01771ce9091dff271cbd2dea (patch)
tree459f482d37957abd162b6bcea6709d51bfc758bf /src/index.tsx
parentf94fa6fb208a903ce46b943b34b94fa65d264b84 (diff)
downloadwhich-ui-af6c0b0730c6a2ab01771ce9091dff271cbd2dea.tar.gz
hotfix/refactor: do not use extra deps in hook
Diffstat (limited to 'src/index.tsx')
-rw-r--r--src/index.tsx8
1 files changed, 5 insertions, 3 deletions
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 => {