refactor: enhance user role handling in List and ability definitions

This commit is contained in:
hamed
2025-11-19 11:48:40 +03:30
parent e26d342c90
commit 18b03ca781
2 changed files with 63 additions and 24 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ export function defineAbilitiesFor(user) {
cannot("access", "Login");
const parsedData = JSON.parse(user.value);
if (parsedData.roles.find((item) => item === "representation")) {
if (parsedData.roles && Object.values(parsedData.roles).includes("representation")) {
can("access", "Panel");
}
} else {