MCPcopy Index your code
hub / github.com/OpenSignLabs/OpenSign / handleAddRole

Function handleAddRole

apps/OpenSign/src/pages/TemplatePlaceholder.jsx:1220–1246  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

1218 // `handleAddRole` function is called when use click on add button in addRole modal
1219 // save Role in entry in signerList and user
1220 const handleAddRole = (e) => {
1221 e?.preventDefault?.();
1222 const count = signersdata.length > 0 ? signersdata.length + 1 : 1;
1223 const Id = randomId();
1224 const index = signersdata.length;
1225 const obj = {
1226 Role: roleName || "Role " + count,
1227 Id: Id,
1228 blockColor: color[index]
1229 };
1230 setSignersData((prevArr) => [...prevArr, obj]);
1231 const signerPosObj = {
1232 signerPtr: {},
1233 signerObjId: "",
1234 blockColor: color[index],
1235 Role: roleName || "Role " + count,
1236 Id: Id
1237 };
1238
1239 setSignerPos((prev) => [...prev, signerPosObj]);
1240 setIsModalRole(false);
1241 setRoleName("");
1242 setCurrWidgetsDetails({});
1243 setUniqueId(Id);
1244 setBlockColor(color[index]);
1245 setIsSelectId(index);
1246 };
1247 // `handleDeleteUser` function is used to delete record and placeholder when user click on delete which is place next user name in recipients list
1248 const handleDeleteUser = (Id) => {
1249 const updateSigner = signersdata

Callers

nothing calls this directly

Calls 1

randomIdFunction · 0.90

Tested by

no test coverage detected