client/src/components/NewGroupModal/NewGroupModal.js
// Adds new subgroup info to User documents
Adds new subgroup info to User documents
Adds new subgroup info to User documents
function addSubGroupToUsers(users, subGroupData) {
    let totalCount = users.length;
    let completedCount = 0;
    for (let i = 0; i < totalCount; i++) {
      API.addSubGroupToUser(users[i]._id, subGroupData)
        .then((res) => {
          console.log(res);
          completedCount += 1;
          if (completedCount === totalCount) {
            refreshUser(userState.username);
          }
        })
        .catch((err) => console.log(err));
    }
  }
function addSubGroupToUsers ( users , subGroupData ) { let totalCount = users . length ; let completedCount = 0 ; for ( let i = 0 ; i < totalCount ; i ++ ) { API . addSubGroupToUser ( users [ i ] . _id , subGroupData ) . then ( ( res ) => { console . log ( res ) ; completedCount += 1 ; if ( completedCount === totalCount ) { refreshUser ( userState . username ) ; } } ) . catch ( ( err ) => console . log ( err ) ) ; } }
Adds new subgroup info to User documents
Adds new subgroup info to User documents