diff --git a/src/components/Header/index.jsx b/src/components/Header/index.jsx index 7c22ef0..8af9a48 100644 --- a/src/components/Header/index.jsx +++ b/src/components/Header/index.jsx @@ -1,9 +1,11 @@ import { useDispatch } from 'react-redux'; import { logout } from '../../actions'; +import { useNavigate } from 'react-router-dom'; const Header = (props) => { const dispatch = useDispatch(); + const navigate = useNavigate(); const handleLogoutClick = () => { dispatch(logout()) diff --git a/src/pages/Login/index.jsx b/src/pages/Login/index.jsx index 4a1144a..077b06a 100644 --- a/src/pages/Login/index.jsx +++ b/src/pages/Login/index.jsx @@ -48,7 +48,7 @@ const Login = () => { } useEffect(() => { - if(auth != {}) { + if(Object.keys(auth).length > 0) { navigate("/dashboard") } }) @@ -116,6 +116,15 @@ const Login = () => { +

demo account

+

superadmin

+

email: superadmin@superadmin.com

+

password: 12345

+

admin

+

email: admin@admin.com

+

password: 12345

+

email: author@author

+

password: 12345

)