Skip to content

Commit

Permalink
Merge pull request #800 from AI4Bharat/login
Browse files Browse the repository at this point in the history
Removed already existing user names from dropdown
  • Loading branch information
aparna-aa authored Aug 19, 2024
2 parents b805227 + 1071ee4 commit 34d6d28
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/common/AddProjectMembers.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";

import { useSelector } from "react-redux";
//Components
import {
Button,
Expand Down Expand Up @@ -30,8 +30,13 @@ const AddProjectMembers = ({
handleSelectField,
managerNames,
}) => {
const acceptedManagers = managerNames.filter((manager) => manager.has_accepted_invite==true);

const alreadyExistingUsers = useSelector((state)=>state.
getProjectMembers.data);
console.log(alreadyExistingUsers);
const acceptedManagers = managerNames.filter((manager) =>manager.has_accepted_invite === true &&
!alreadyExistingUsers.some((user) => user.id === manager.id)
);
console.log(acceptedManagers)
const filterOptions = (options, state) => {
const newOptions = options.filter((user) => {
const { first_name, last_name, email } = user;
Expand Down

0 comments on commit 34d6d28

Please sign in to comment.