Projekt

Obecné

Profil

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