이용내역 권한 관련
This commit is contained in:
@@ -6,6 +6,7 @@ import { MenuItem } from '../model/types';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { MenuItems } from '@/entities/common/model/constant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
|
||||
export interface MenuCategoryProps {
|
||||
menuId?: number;
|
||||
@@ -34,21 +35,12 @@ export const MenuCategory = ({
|
||||
}: MenuCategoryProps) => {
|
||||
const { navigate } = useNavigate();
|
||||
const { i18n } = useTranslation();
|
||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
||||
|
||||
const [favoriteItems, setFavoriteItems] = useState<Array<UserFavorite>>([]);
|
||||
const [menuIds, setMenuIds] = useState<Array<number | undefined>>([]);
|
||||
|
||||
const checkGrant = (menuId?: number) => {
|
||||
const myGrants = menuGrantsByKey['' + menuId];
|
||||
if(myGrants?.includes('R')){
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
const onClickToNavigate = (menuId?: number, path?: string) => {
|
||||
if(menuId && checkGrant(menuId)){
|
||||
if(menuId && checkGrant(menuId, 'R')){
|
||||
if(!!path && !!setMenuOn && !editMode){
|
||||
setMenuOn(false);
|
||||
navigate(path);
|
||||
|
||||
Reference in New Issue
Block a user