feat: 권한별 메뉴 반영

main
minuk926 3 years ago
parent 6414cd31af
commit 1db73f0438

@ -9,6 +9,7 @@ import useAuth from 'hooks/useAuth';
import other from 'menu-items/other'; import other from 'menu-items/other';
import admin from 'menu-items/admin'; import admin from 'menu-items/admin';
import judge from 'menu-items/judge';
import dashboard from 'menu-items/dashboard'; import dashboard from 'menu-items/dashboard';
// ==============================|| SIDEBAR MENU LIST ||============================== // // ==============================|| SIDEBAR MENU LIST ||============================== //
@ -16,7 +17,7 @@ import dashboard from 'menu-items/dashboard';
const MenuList = () => { const MenuList = () => {
const { accesstype } = useAuth(); const { accesstype } = useAuth();
const menuItem = accesstype === '001' ? { items: [dashboard, admin, other] } : { items: [admin] }; const menuItem = accesstype === '001' ? { items: [dashboard, admin, other] } : { items: [judge] };
const navItems = menuItem.items.map((item) => { const navItems = menuItem.items.map((item) => {
switch (item.type) { switch (item.type) {

@ -11,6 +11,7 @@ import Header from './Header';
import Sidebar from './Sidebar'; import Sidebar from './Sidebar';
import other from 'menu-items/other'; import other from 'menu-items/other';
import admin from 'menu-items/admin'; import admin from 'menu-items/admin';
import judge from 'menu-items/judge';
import dashboard from 'menu-items/dashboard'; import dashboard from 'menu-items/dashboard';
import useConfig from 'hooks/useConfig'; import useConfig from 'hooks/useConfig';
import { drawerWidth } from 'store/constant'; import { drawerWidth } from 'store/constant';
@ -118,7 +119,7 @@ const MainLayout = () => {
<Container maxWidth="lg"> <Container maxWidth="lg">
<Breadcrumbs <Breadcrumbs
separator={IconChevronRight} separator={IconChevronRight}
navigation={accesstype === '001' ? { items: [dashboard, admin, other] } : { items: [admin] }} navigation={accesstype === '001' ? { items: [dashboard, admin, other] } : { items: [judge] }}
icon icon
title title
rightAlign rightAlign
@ -130,7 +131,7 @@ const MainLayout = () => {
<> <>
<Breadcrumbs <Breadcrumbs
separator={IconChevronRight} separator={IconChevronRight}
navigation={accesstype === '001' ? { items: [dashboard, admin, other] } : { items: [admin] }} navigation={accesstype === '001' ? { items: [dashboard, admin, other] } : { items: [judge] }}
icon icon
title title
rightAlign rightAlign

@ -1,13 +0,0 @@
import other from './other';
import admin from './admin';
import dashboard from './dashboard';
// ==============================|| MENU ITEMS ||============================== //
export const adminMenuItems = {
items: [dashboard, admin, other]
};
export const judgeMenuItems = {
items: [dashboard, admin, other]
};
Loading…
Cancel
Save