Т
https://codepen.io/DiRover/pen/MWbKxXv
Size: a a a
Т
DM

MZ
DR
DR
Т
DM
АМ
MZ
DM
MZ
const location = useLocation()
const history = useHistory()
const dispatch = useDispatch()
useEffect(() => {
dispatch(takeUserInfo())
}, [dispatch])
// Protected route
const token = windowwindow.sessionStorage.getItem("token")
useEffect(() => {
if (!token) {
history.push("/login")
}
}, [token])
const currentPage = location.pathname
const pageRendering = () => {
switch (currentPage) {
case "/admin/general-info":
dispatch(changeSidebarTab("general-info"))
return <GeneralInfo t={t}/>
case "/admin/employee":
dispatch(changeSidebarTab("employee"))
return <Employee t={t} />
}
}
return(
// TODO: Rename dashboard wrapper and push it to upper code level,// possibly to public index.html
<div className="dashboard_wrapper">
<HeaderWithUser
withSearch={true}
notification={true}
withSidebar={true}
t={t}
/>
</div>
)
const mapStateToProps = (state:RootState) => {
return {
sidebar: state.sidebar.sidebarCon,
sidebarTab: state.sidebar.sidebarTabCondition
}
}
export default connectconnect(mapStateToProps, null)(DashboardPage)V
DK
N
N
V

N
N
N
V