Skip to content

Commit 1fa6e51

Browse files
committed
fix users api
Signed-off-by: aabidsofi19 <[email protected]>
1 parent 6d1a877 commit 1fa6e51

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/custom/ShareModal/ShareModal.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ const ShareModal: React.FC<ShareModalProps> = ({
232232
const handleShareWithNewUsers = async (newUsers: User[]) => {
233233
console.log("new users", newUsers)
234234
const grantAccessList = newUsers.map(user => ({
235-
actor_id: user.user_id ?? user.id,
235+
actor_id: user.user_id,
236236
actor_type: "user"
237237
}))
238238
const emails = newUsers.map(u => u.email)
@@ -247,8 +247,6 @@ const ShareModal: React.FC<ShareModalProps> = ({
247247
}
248248
})
249249

250-
251-
252250
if (!response?.error) {
253251
const msg = `${dataName} shared with ${emails.join(", ")} `;
254252
notify({

src/custom/UserSearchField/UserSearchField.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ const UserShareSearch: React.FC<UserSearchFieldProps> = ({
4444
pagesize:10,
4545
},{skip: debouncedInput.trim().length == 0})
4646

47-
const suggestions = (usersMatchingSearch?.data ?? []) as User[]
4847

49-
const open = inputValue.trim().length > 0 && suggestions?.length > 0
48+
const suggestions = usersMatchingSearch?.data ?? [] as User[]
49+
50+
// const open = inputValue.trim().length > 0 && suggestions?.length > 0
5051

5152

5253
const handleShareWithNewUsers = async () => {
54+
console.log("users to share with",usersToShareWith)
5355
try {
5456
setIsSharing(true);
5557
const result = await shareWithNewUsers(usersToShareWith);
@@ -87,6 +89,7 @@ const UserShareSearch: React.FC<UserSearchFieldProps> = ({
8789
);
8890

8991

92+
9093
const isShareDisabled = disabled || isSharing || usersToShareWith.length === 0;
9194

9295
const UserChip = ({ avatarObj, ...props }: { avatarObj: User }) => (
@@ -122,12 +125,12 @@ const UserShareSearch: React.FC<UserSearchFieldProps> = ({
122125
multiple
123126
disableListWrap
124127
disabled={isSharing}
125-
open={open}
128+
// open={open}
126129
inputValue={inputValue}
127130
loading={searchUserLoading}
128131
value={usersToShareWith}
129132
getOptionLabel={(user) => user.email}
130-
noOptionsText={searchUserLoading ? 'Loading...' : 'No users found'}
133+
noOptionsText={searchUserLoading ? 'Loading...' : (inputValue=="" ? "Search using name or email" :'No users found')}
131134
onChange={handleAdd}
132135
onInputChange={handleInputChange}
133136
isOptionEqualToValue={(option, value) => option.email === value.email}

0 commit comments

Comments
 (0)