fixed indexing wrong group when getting permissions
This commit is contained in:
parent
1b1d6e4485
commit
b4c1a543de
4 changed files with 53 additions and 21 deletions
|
|
@ -120,10 +120,15 @@ export default function Devices() {
|
|||
setGroups(newGroups);
|
||||
};
|
||||
|
||||
const getGroupKey = () => {
|
||||
return parseInt(tab+1)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
setGroupPermissions([])
|
||||
if (tab === "all") return
|
||||
groupAPI.getGroupPermissions(parseInt(tab)).then(resp => {
|
||||
groupAPI.getGroupPermissions(getGroupKey()).then(resp => {
|
||||
console.log(resp)
|
||||
setGroupPermissions(resp.data.permissions)
|
||||
})
|
||||
}, [tab])
|
||||
|
|
@ -155,7 +160,7 @@ export default function Devices() {
|
|||
if (tab !== "all") {
|
||||
let keys = getContextKeys()
|
||||
//keys.splice(keys.length - 1, 0, getGroup().id().toString());
|
||||
keys.push(getGroup().id().toString());
|
||||
keys.push(getGroupKey().toString());
|
||||
return keys
|
||||
} else {
|
||||
return getContextKeys()
|
||||
|
|
@ -376,7 +381,7 @@ export default function Devices() {
|
|||
}
|
||||
|
||||
const getGroup = () => {
|
||||
let group = groups[parseInt(tab)]
|
||||
let group = groups[parseInt(tab+1)]
|
||||
return group
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue