Projekt

Obecné

Profil

Stáhnout (832 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1
import { Button } from '@mui/material'
2
import { useDispatch, useSelector } from 'react-redux'
3
import { logout } from '../Auth/userSlice'
4
import CatalogItemDetail from '../Catalog/CatalogItemDetail'
5
import { RootState } from '../redux/store'
6

    
7
const Home = () => {
8
    const dispatch = useDispatch()
9

    
10
    const userLoggedIn = useSelector(
11
        (state: RootState) => state.user.isLoggedIn
12
    )
13

    
14
    return (
15
        <>
16
            <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
            <CatalogItemDetail />
28
        </>
29
    )
30
}
31

    
32
export default Home
    (1-1/1)