Projekt

Obecné

Profil

Stáhnout (737 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1 fc79a8cb Vaclav Honzik
import { Button } from '@mui/material'
2
import { useDispatch, useSelector } from 'react-redux'
3
import { logout } from '../Auth/userSlice'
4
import { RootState } from '../redux/store'
5
6 c7d2ced1 Václav Honzík
const Home = () => {
7 fc79a8cb Vaclav Honzik
    const dispatch = useDispatch()
8
9
    const userLoggedIn = useSelector(
10
        (state: RootState) => state.user.isLoggedIn
11
    )
12 c7d2ced1 Václav Honzík
13 fc79a8cb Vaclav Honzik
    return (
14
        <>
15
            <h1>Home</h1>
16
            {userLoggedIn ? (
17
                <Button
18
                    size="large"
19
                    variant="contained"
20
                    color="primary"
21
                    onClick={() => dispatch(logout())}
22
                >
23
                    Logout
24
                </Button>
25
            ) : null}
26
        </>
27
    )
28 c7d2ced1 Václav Honzík
}
29
30 fc79a8cb Vaclav Honzik
export default Home