diff --git a/src/pages/Documents/index.jsx b/src/pages/Documents/index.jsx index e65b331..d3882fb 100755 --- a/src/pages/Documents/index.jsx +++ b/src/pages/Documents/index.jsx @@ -5,7 +5,7 @@ import { Layout } from 'antd' import { RootPathContext, useRootPath } from '@asb/context' import { PrivateMenu } from '@components/Private' -import { getTabname, wrapPrivateComponent, NoAccessComponent } from '@utils' +import { getTabname, wrapPrivateComponent, NoAccessComponent, hasPermission } from '@utils' import DocumentsTemplate from './DocumentsTemplate' @@ -31,27 +31,28 @@ const MenuDocuments = memo(() => { const root = useRootPath() const rootPath = useMemo(() => `${root}/document`, [root]) + const categories = useMemo(() => documentCategories.filter(({ permissions }) => hasPermission(permissions))) + return ( - {documentCategories.map(category => ( + {categories.map(category => ( } title={category.title} - permissions={category.permissions} /> ))} - {documentCategories.length > 0 && ( - } /> + {categories.length > 0 && ( + } /> )} } /> - {documentCategories.map(category => ( + {categories.map(category => (