MSP-3105 add roleUtils in utils
This commit is contained in:
1 parent
58075955dc
commit
76f2e6d3c3
1 file changed
+16
@@ -0,0 +1,16 @@
|
||||
import { RoleType } from '@type/roles.type.ts'
|
||||
|
||||
export const findExclusiveRole = (
|
||||
roles: RoleType[],
|
||||
watchRoles: number[] = []
|
||||
) => {
|
||||
let firstExclusiveElement = null
|
||||
for (let i = 0; i < roles.length; i++) {
|
||||
const item = roles[i]
|
||||
if (item.exclusive === true && watchRoles.includes(item.id)) {
|
||||
firstExclusiveElement = item
|
||||
break
|
||||
}
|
||||
}
|
||||
return firstExclusiveElement
|
||||
}
|
||||
Reference in new issue
Block a user