권한 read
This commit is contained in:
@@ -12,6 +12,7 @@ import { useNavigate } from '@/shared/lib/hooks';
|
|||||||
import { PATHS } from '@/shared/constants/paths';
|
import { PATHS } from '@/shared/constants/paths';
|
||||||
import { useStore } from '@/shared/model/store';
|
import { useStore } from '@/shared/model/store';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
|
||||||
export const BoxContainer1 = () => {
|
export const BoxContainer1 = () => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
@@ -56,8 +57,22 @@ 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 = () => {
|
const onClickToNavigate = () => {
|
||||||
navigate(PATHS.settlement.list);
|
if(checkGrant(36)){
|
||||||
|
navigate(PATHS.settlement.list);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showAlert('권한이 없습니다.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { useNavigate } from '@/shared/lib/hooks';
|
|||||||
import { PATHS } from '@/shared/constants/paths';
|
import { PATHS } from '@/shared/constants/paths';
|
||||||
import { useStore } from '@/shared/model/store';
|
import { useStore } from '@/shared/model/store';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
|
||||||
export const BoxContainer2 = () => {
|
export const BoxContainer2 = () => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
@@ -80,8 +81,22 @@ export const BoxContainer2 = () => {
|
|||||||
callOverview();
|
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 = () => {
|
const onClickToNavigate = () => {
|
||||||
navigate(PATHS.settlement.list);
|
if(checkGrant(36)){
|
||||||
|
navigate(PATHS.settlement.list);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showAlert('권한이 없습니다.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const translateDayOfWeek = (koreanDay: string): string => {
|
const translateDayOfWeek = (koreanDay: string): string => {
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
|||||||
import { NoticeItemProps } from '@/entities/support/model/types';
|
import { NoticeItemProps } from '@/entities/support/model/types';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { IMAGE_ROOT } from '@/shared/constants/common';
|
import { IMAGE_ROOT } from '@/shared/constants/common';
|
||||||
|
import { useStore } from '@/shared/model/store';
|
||||||
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
|
||||||
export const HomeNoticeItem = ({
|
export const HomeNoticeItem = ({
|
||||||
noticeItem,
|
noticeItem,
|
||||||
@@ -20,13 +22,25 @@ export const HomeNoticeItem = ({
|
|||||||
}
|
}
|
||||||
return moment(date).format('YYYY.MM.DD');
|
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 = () => {
|
const onClickToDetail = () => {
|
||||||
if(setDetailData){
|
if(checkGrant(62)){
|
||||||
setDetailData({
|
if(setDetailData){
|
||||||
seq: noticeItem.seq,
|
setDetailData({
|
||||||
detailOn: true
|
seq: noticeItem.seq,
|
||||||
});
|
detailOn: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showAlert('권한이 없습니다.');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user