Merge remote-tracking branch 'origin/staging' into origin/production
This commit is contained in:
@@ -7,6 +7,8 @@ import { NavListProps } from '../type';
|
|||||||
//
|
//
|
||||||
import { NavItemRoot, NavItemSub } from './NavItem';
|
import { NavItemRoot, NavItemSub } from './NavItem';
|
||||||
import { getActive } from '..';
|
import { getActive } from '..';
|
||||||
|
import { accessGroup } from '@/layouts/dashboard/navbar/NavConfig';
|
||||||
|
import useAuth from '@/hooks/useAuth';
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -59,6 +61,7 @@ type NavListSubProps = {
|
|||||||
|
|
||||||
function NavListSub({ list }: NavListSubProps) {
|
function NavListSub({ list }: NavListSubProps) {
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
|
const {user} = useAuth()
|
||||||
|
|
||||||
const active = getActive(list.path, pathname);
|
const active = getActive(list.path, pathname);
|
||||||
|
|
||||||
@@ -82,5 +85,15 @@ function NavListSub({ list }: NavListSubProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return <NavItemSub item={list} active={active} />;
|
if (accessGroup.admin.includes(list.path) && user?.role_id === 1) {
|
||||||
|
return <NavItemSub item={list} active={active} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!accessGroup.admin.includes(list.path)) {
|
||||||
|
return <NavItemSub item={list} active={active} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
return <></>;
|
||||||
|
|
||||||
|
// return <NavItemSub item={list} active={active} />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ const ICONS = {
|
|||||||
hospital: getIcon('ic_banking'),
|
hospital: getIcon('ic_banking'),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const accessGroup = {
|
||||||
|
admin: ["/report/logs"]
|
||||||
|
}
|
||||||
|
|
||||||
const navConfig = [
|
const navConfig = [
|
||||||
// GENERAL
|
// GENERAL
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user