fix(403): название раздела на странице Forbidden
Refs EventHub/EventHubFrontAdmin#22 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,14 +1,20 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Button, Result } from 'antd';
|
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 ForbiddenPage: React.FC = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const location = useLocation();
|
||||||
|
const sectionKey = getMenuSelectedKey(location.pathname);
|
||||||
|
const sectionLabel =
|
||||||
|
MENU_ITEMS.find((item) => item.key === sectionKey)?.label ?? 'этот раздел';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Result
|
<Result
|
||||||
status="403"
|
status="403"
|
||||||
title="403"
|
title="403"
|
||||||
subTitle="У вас нет доступа к этому разделу."
|
subTitle={`У вас нет доступа к разделу «${sectionLabel}».`}
|
||||||
extra={
|
extra={
|
||||||
<Button type="primary" onClick={() => navigate('/dashboard')}>
|
<Button type="primary" onClick={() => navigate('/dashboard')}>
|
||||||
На дашборд
|
На дашборд
|
||||||
|
|||||||
Reference in New Issue
Block a user