Skip to content

Commit

Permalink
fix login page
Browse files Browse the repository at this point in the history
  • Loading branch information
HoaAyWK committed Nov 18, 2022
1 parent b84e2f9 commit 354b277
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"yup": "^0.32.11"
},
"scripts": {
"start": "react-scripts start",
"start": "set PORT=3006 && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
Expand Down
8 changes: 3 additions & 5 deletions src/pages/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Page from '../components/Page';
import Logo from '../components/Logo';
import { LoginForm } from '../features/auth/login';
import { action_status, MESSAGE_ERRORS, ROLES } from '../app/constants';
import { getCurrentUser, refresh } from '../app/slices/authSlice';
import { getCurrentUser, refresh, logout } from '../app/slices/authSlice';
import useLocalStorage from '../hooks/useLocalStorage';
import { setMessage } from '../app/slices/messageSlice';

Expand Down Expand Up @@ -70,10 +70,8 @@ const Login = () => {
const dispatch = useDispatch();

useEffect(() => {
if (token) {
dispatch(getCurrentUser());
}
}, [token, dispatch]);
dispatch(logout());
}, [dispatch]);

useEffect(() => {
if (loginStatus === action_status.SUCCEEDED) {
Expand Down

0 comments on commit 354b277

Please sign in to comment.