Skip to content

Commit

Permalink
UI restriction based on user roles
Browse files Browse the repository at this point in the history
  • Loading branch information
wmazoni committed May 1, 2024
1 parent df83c2a commit 22d33b4
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions frontend/src/pages/Admin/Navbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import { NavLink } from 'react-router-dom';
import './styles.css'
import './styles.css';
import { hasAnyRoles } from 'util/requests';

const Navbar = () => {
return (
<nav className='admin-nav-container'>
<nav className="admin-nav-container">
<ul>
<li>
<NavLink to='/admin/products' className='admin-nav-item'>
<NavLink to="/admin/products" className="admin-nav-item">
<p>Produtos</p>
</NavLink>
</li>
<li>
<NavLink to='/admin/categories' className='admin-nav-item'>
<NavLink to="/admin/categories" className="admin-nav-item">
<p>Categorias</p>
</NavLink>
</li>
<li>
<NavLink to='/admin/users' className='admin-nav-item'>
<p>Usuários</p>
</NavLink>
</li>
{hasAnyRoles(['ROLE_ADMIN']) && (
<li>
<NavLink to="/admin/users" className="admin-nav-item">
<p>Usuários</p>
</NavLink>
</li>
)}
</ul>
</nav>
);
Expand Down

0 comments on commit 22d33b4

Please sign in to comment.