fix: user current role (#232)

This commit is contained in:
ChengLei Shao 2022-03-11 15:51:46 +08:00 committed by GitHub
parent d98714d9fd
commit 264a1e6c21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,7 @@ function setCurrentRole(ctx, user) {
userRole = userRoles[0].get('name'); userRole = userRoles[0].get('name');
} else if (userRoles.length > 1) { } else if (userRoles.length > 1) {
const defaultRole = userRoles.findIndex((role) => role.get('rolesUsers').default); const defaultRole = userRoles.findIndex((role) => role.get('rolesUsers').default);
userRole = defaultRole !== -1 ? userRoles[defaultRole] : userRoles[0]; userRole = (defaultRole !== -1 ? userRoles[defaultRole] : userRoles[0]).get('name');
} }
if (userRole) { if (userRole) {