Search...
listMembers( )
Lists the IDs of all members assigned to a badge.
Description
The listMembers()
function returns a Promise that resolves
to a list of member IDs assigned to the specified badge.
Note: This function replaces the deprecated
wix-users-backend.badges.listMembers()
. The deprecated function will continue to work, but it will not receive updates. To keep any existing code compatible with future changes, see the migration instructions.
Syntax
function listMembers(badgeId: string): Promise<Array<string>>
listMembers Parameters
NAME
TYPE
DESCRIPTION
badgeId
string
ID of the badge to list members of.
Returns
Fulfilled - IDs of the members assigned to the badge. Rejected - Error message.
Return Type:
Promise<Array<string>>
Was this helpful?
List members assigned to a badge
Copy Code
1import { badges } from 'wix-members-backend';23export function myListMembersFunction() {4 const badgeId = "571495e9-98af-4ec9-b854-16c0293c9312";56 return badges.listMembers(badgeId)7 .then((memberIds) => {8 const firstMember = memberIds[0];9 return memberIds;10 })11 .catch((error) => {12 console.error(error);13 });14}1516/*17 * Promise resolves to:18 * [19 * "28d35f86-6694-4455-9dff-aff5d450b482",20 * "72751428-2743-4bda-acf5-4218a4279cd3",21 * "8831eed6-928e-4f85-b80a-e1e48fb7c4fd"22 * ]23 */