aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 => {