sanity-plugin-utils
2.0.62.0.7
dist/index.js~
dist/index.jsModified+3−3
Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -121,16 +121,16 @@
$[3] !== client || $[4] !== currentUser?.id || $[5] !== users.length ? (t4 = () => {
let { projectId } = client.config();
users.length || async function() {
try {
- let aclData = await client.request({ url: `/projects/${projectId}/acl` }), userIdChunks = chunkArray(aclData.map(_temp$1), 200);
- setUsers((await Promise.all(userIdChunks.map((chunk) => client.request({ url: `/projects/${projectId}/users/${chunk.join(",")}` })))).flat().map((user_0) => {
+ let aclData = await client.request({ url: `/projects/${projectId}/acl` }), userIdChunks = chunkArray(aclData.map(_temp$1), 200), usersWithRoles = (await Promise.all(userIdChunks.map((chunk) => client.request({ url: `/projects/${projectId}/users/${chunk.join(",")}` })))).flat().map((user_0) => {
let userRoles = aclData.find((aclUser) => aclUser.projectUserId === user_0.id)?.roles || [];
return Object.assign(user_0, {
isCurrentUser: user_0.id === currentUser?.id,
roles: userRoles
});
- }));
+ });
+ setUsers(usersWithRoles);
} catch (t5) {
console.error("Failed to fetch users:", t5);
}
}();