이용내역 권한 관련
This commit is contained in:
@@ -13,6 +13,7 @@ import { PATHS } from '@/shared/constants/paths';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
|
||||
export const BoxContainer1 = () => {
|
||||
const { navigate } = useNavigate();
|
||||
@@ -57,17 +58,8 @@ export const BoxContainer1 = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const checkGrant = (menuId?: number) => {
|
||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
||||
const myGrants = menuGrantsByKey['' + menuId];
|
||||
if(myGrants?.includes('R')){
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const onClickToNavigate = () => {
|
||||
if(checkGrant(36)){
|
||||
if(checkGrant(36, 'R')){
|
||||
navigate(PATHS.settlement.list);
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -9,6 +9,7 @@ import { PATHS } from '@/shared/constants/paths';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
|
||||
export const BoxContainer2 = () => {
|
||||
const { navigate } = useNavigate();
|
||||
@@ -81,17 +82,8 @@ export const BoxContainer2 = () => {
|
||||
callOverview();
|
||||
}, []);
|
||||
|
||||
const checkGrant = (menuId?: number) => {
|
||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
||||
const myGrants = menuGrantsByKey['' + menuId];
|
||||
if(myGrants?.includes('R')){
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const onClickToNavigate = () => {
|
||||
if(checkGrant(36)){
|
||||
if(checkGrant(36, 'R')){
|
||||
navigate(PATHS.settlement.list);
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -7,6 +7,7 @@ import { UserFavorite } from '@/entities/user/model/types';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
|
||||
export interface FavoriteWrapperProps {
|
||||
usingType: 'home' | 'menu',
|
||||
@@ -25,8 +26,7 @@ export const FavoriteWrapper = ({
|
||||
}: FavoriteWrapperProps) => {
|
||||
const { navigate } = useNavigate();
|
||||
const { i18n, t } = useTranslation();
|
||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
||||
|
||||
|
||||
const [favoriteItems, setFavoriteItems] = useState<Array<UserFavorite>>([]);
|
||||
|
||||
const itemAdd: UserFavorite = {
|
||||
@@ -42,16 +42,9 @@ export const FavoriteWrapper = ({
|
||||
setEditMode(true);
|
||||
}
|
||||
};
|
||||
const checkGrant = (menuId?: number) => {
|
||||
const myGrants = menuGrantsByKey['' + menuId];
|
||||
if(myGrants?.includes('R') || menuId === -1){
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const onClickToNavigate = (menuId?: number, path?: string) => {
|
||||
if(menuId && checkGrant(menuId)){
|
||||
if(menuId && checkGrant(menuId, 'R')){
|
||||
if(!!path){
|
||||
navigate(path);
|
||||
if(setMenuOn){
|
||||
|
||||
@@ -6,12 +6,12 @@ import { useTranslation } from 'react-i18next';
|
||||
import { IMAGE_ROOT } from '@/shared/constants/common';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
|
||||
export const HomeNoticeItem = ({
|
||||
noticeItem,
|
||||
setDetailData,
|
||||
}: NoticeItemProps) => {
|
||||
const { navigate } = useNavigate();
|
||||
const { t, i18n } = useTranslation();
|
||||
|
||||
const formatDate = (date?: string) => {
|
||||
@@ -22,16 +22,9 @@ export const HomeNoticeItem = ({
|
||||
}
|
||||
return moment(date).format('YYYY.MM.DD');
|
||||
};
|
||||
const checkGrant = (menuId?: number) => {
|
||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
||||
const myGrants = menuGrantsByKey['' + menuId];
|
||||
if(myGrants?.includes('R')){
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const onClickToDetail = () => {
|
||||
if(checkGrant(62)){
|
||||
if(checkGrant(62, 'R')){
|
||||
if(setDetailData){
|
||||
setDetailData({
|
||||
seq: noticeItem.seq,
|
||||
|
||||
Reference in New Issue
Block a user