1
|
import { Fragment, useEffect } from 'react'
|
2
|
import { useSelector } from 'react-redux'
|
3
|
import { useNavigate } from 'react-router-dom'
|
4
|
import { RootState } from '../redux/store'
|
5
|
import LoginDialog from './LoginDialog'
|
6
|
import NotAuthorized from "../NotAuthorized/NotAuthorized"
|
7
|
import RegisterDialog from "./RegisterDialog"
|
8
|
|
9
|
|
10
|
const Register = () => {
|
11
|
const isAdmin = useSelector(
|
12
|
(state: RootState) => state.user.roles.includes("ROLE_ADMIN")
|
13
|
)
|
14
|
|
15
|
return (
|
16
|
<Fragment>
|
17
|
{isAdmin ? (<RegisterDialog />) : <NotAuthorized />}
|
18
|
</Fragment>
|
19
|
)
|
20
|
}
|
21
|
|
22
|
export default Register
|