[#50] added attendee search and tests
This commit is contained in:
committed by
Benoit TELLIER
parent
9a58c485ac
commit
d7b3d4e077
@@ -4,3 +4,24 @@ export default async function getOpenPaasUser() {
|
||||
const user = await api.get(`api/user`).json();
|
||||
return user;
|
||||
}
|
||||
|
||||
export async function searchUsers(query: string) {
|
||||
const response: any[] = await api
|
||||
.post(`api/people/search/`, {
|
||||
body: JSON.stringify({
|
||||
limit: 10,
|
||||
objectTypes: ["user", "group", "contact", "ldap"],
|
||||
q: query,
|
||||
}),
|
||||
})
|
||||
.json();
|
||||
|
||||
return response
|
||||
.filter((user) => user.objectType === "user")
|
||||
.map((user) => ({
|
||||
email: user.emailAddresses?.[0]?.value || "",
|
||||
displayName:
|
||||
user.names?.[0]?.displayName || user.emailAddresses?.[0]?.value,
|
||||
avatarUrl: user.photos?.[0]?.url || "",
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user