ㅇ
This commit is contained in:
@@ -49,7 +49,6 @@ export const MenuCategory = ({
|
||||
else{
|
||||
showAlert(t('common.nopermission'));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const favoriteSetting = (
|
||||
@@ -61,12 +60,14 @@ export const MenuCategory = ({
|
||||
programPath?: string,
|
||||
) => {
|
||||
let userFavorite = useStore.getState().UserStore.userFavorite;
|
||||
if(checked){
|
||||
// 즐겨찾기가 4개 이상일 경우 마지막 항목 제거
|
||||
if(userFavorite.length >= 10){
|
||||
showAlert('즐겨찾기는 10개까지만 추가 할수 있습니다.');
|
||||
}
|
||||
else{
|
||||
if(userFavorite.length >= 10){
|
||||
showAlert('즐겨찾기는 10개까지만 추가 할수 있습니다.');
|
||||
}
|
||||
else if(userFavorite.length <= 1){
|
||||
showAlert('바로가기는 1개이상 설정 필요 합니다.');
|
||||
}
|
||||
else{
|
||||
if(checked){
|
||||
userFavorite = [
|
||||
...userFavorite,
|
||||
{
|
||||
@@ -78,21 +79,15 @@ export const MenuCategory = ({
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
else{
|
||||
// 즐겨찾기가 1개 남았을 때는 해제하지 않음
|
||||
if(userFavorite.length <= 1){
|
||||
callFavoiteItems();
|
||||
return;
|
||||
else{
|
||||
userFavorite = userFavorite.filter((value, _) => {
|
||||
return value.menuId !== menuId
|
||||
});
|
||||
}
|
||||
userFavorite = userFavorite.filter((value, _) => {
|
||||
return value.menuId !== menuId
|
||||
});
|
||||
useStore.getState().UserStore.setUserFavorite(userFavorite);
|
||||
setChangeMenuId(`${menuId}-${checked}`);
|
||||
callFavoiteItems();
|
||||
}
|
||||
useStore.getState().UserStore.setUserFavorite(userFavorite);
|
||||
setChangeMenuId(`${menuId}-${checked}`);
|
||||
callFavoiteItems();
|
||||
|
||||
};
|
||||
|
||||
const callFavoiteItems = () => {
|
||||
@@ -103,11 +98,7 @@ export const MenuCategory = ({
|
||||
});
|
||||
setMenuIds(newArr);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
callFavoiteItems();
|
||||
}, [changeMenuId]);
|
||||
|
||||
|
||||
const getMenuItems = () => {
|
||||
let rs = [];
|
||||
if(subMenu){
|
||||
@@ -165,6 +156,10 @@ export const MenuCategory = ({
|
||||
? MenuItems.find(item => item.menuId === menuId)?.menuNameEng || menuName
|
||||
: menuName;
|
||||
|
||||
useEffect(() => {
|
||||
callFavoiteItems();
|
||||
}, [changeMenuId]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user