diff --git a/src/pages/errors/ForbiddenPage.tsx b/src/pages/errors/ForbiddenPage.tsx index 5d4666b..c875475 100644 --- a/src/pages/errors/ForbiddenPage.tsx +++ b/src/pages/errors/ForbiddenPage.tsx @@ -1,14 +1,20 @@ import React from 'react'; import { Button, Result } from 'antd'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, useLocation } from 'react-router-dom'; +import { getMenuSelectedKey, MENU_ITEMS } from '../../config/adminAccess'; const ForbiddenPage: React.FC = () => { const navigate = useNavigate(); + const location = useLocation(); + const sectionKey = getMenuSelectedKey(location.pathname); + const sectionLabel = + MENU_ITEMS.find((item) => item.key === sectionKey)?.label ?? 'этот раздел'; + return ( navigate('/dashboard')}> На дашборд