blob: ea4574119c0de29922a1d5e3d4101e654461970c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
export const getAccessLevels = (accessLevels = {}) => {
const total = accessLevels.edges?.length;
const accessLevelTypes = { total, users: [], groups: [], roles: [] };
accessLevels.edges?.forEach(({ node }) => {
if (node.user) {
const src = node.user.avatarUrl;
accessLevelTypes.users.push({ src, ...node.user });
} else if (node.group) {
accessLevelTypes.groups.push(node);
} else {
accessLevelTypes.roles.push({ accessLevelDescription: node.accessLevelDescription });
}
});
return accessLevelTypes;
};
|