We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a636c3d commit 24803beCopy full SHA for 24803be
1 file changed
apps/sim/hooks/queries/admin-users.ts
@@ -91,20 +91,17 @@ async function fetchAdminUsersByEmails(
91
const { data, error } = await client.admin.listUsers(
92
{
93
query: {
94
- limit: 20,
95
- searchField: 'email',
96
- searchValue: email,
97
- searchOperator: 'contains',
+ limit: 1,
+ filterField: 'email',
+ filterValue: email,
+ filterOperator: 'eq',
98
},
99
100
{ signal }
101
)
102
if (error) throw new Error(error.message ?? 'Failed to fetch user')
103
- return (
104
- (data?.users ?? [])
105
- .map(mapUser)
106
- .find((u) => u.email.toLowerCase() === email.toLowerCase()) ?? null
107
- )
+ const user = (data?.users ?? [])[0]
+ return user ? mapUser(user) : null
108
})
109
110
return results.filter((u): u is AdminUser => u !== null)
0 commit comments