Show Backoffice menu only for Superadmin users
This commit is contained in:
parent
fb98016afc
commit
78857b7afe
1 changed files with 5 additions and 1 deletions
|
|
@ -89,10 +89,14 @@ const candidateItems = [
|
||||||
export function Sidebar() {
|
export function Sidebar() {
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const user = getCurrentUser()
|
const user = getCurrentUser()
|
||||||
|
const isSuperadmin = user?.role === "superadmin"
|
||||||
|
|
||||||
let items = candidateItems
|
let items = candidateItems
|
||||||
if (isAdminUser(user)) {
|
if (isAdminUser(user)) {
|
||||||
items = adminItems
|
// For Admin (not Superadmin), filter out Backoffice
|
||||||
|
items = isSuperadmin
|
||||||
|
? adminItems
|
||||||
|
: adminItems.filter(item => item.href !== "/dashboard/backoffice")
|
||||||
} else if (user?.role === "company") {
|
} else if (user?.role === "company") {
|
||||||
items = companyItems
|
items = companyItems
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue