fix navigation

This commit is contained in:
nochill 2023-08-22 15:33:27 +07:00
parent f848013787
commit b73ad65d9a
2 changed files with 12 additions and 1 deletions

View File

@ -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())

View File

@ -48,7 +48,7 @@ const Login = () => {
}
useEffect(() => {
if(auth != {}) {
if(Object.keys(auth).length > 0) {
navigate("/dashboard")
}
})
@ -116,6 +116,15 @@ const Login = () => {
</div>
</form>
</div>
<p>demo account</p>
<p>superadmin</p>
<p>email: superadmin@superadmin.com</p>
<p>password: 12345</p>
<p>admin</p>
<p>email: admin@admin.com</p>
<p>password: 12345</p>
<p>email: author@author </p>
<p>password: 12345</p>
</div>
</>
)