Search.../

deleteBadge( )

Deletes a badge.

Description

The deleteBadge() function returns a Promise that resolves when the specified badge is deleted.

Note: This function replaces the deprecated wix-users-backend.badges.deleteBadge(). 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.

The badgeId parameter must be an ID from your site's Members/Badges collection. Typically, you retrieve the ID from the collection using a query or through a dataset.

Syntax

function deleteBadge(badgeId: string): Promise<void>

deleteBadge Parameters

NAME
TYPE
DESCRIPTION
badgeId
string

ID of the badge to delete.

Returns

Fulfilled - When the badge is deleted. Rejected - Error message.

Return Type:

Promise<void>

Was this helpful?

Delete a badge

Copy Code
1import { badges } from 'wix-members-backend';
2
3export function myDeleteBadgeFunction() {
4 const badgeId = "95fad9e6-d4dc-4d84-98a2-ae8660cce599";
5
6 return badges.deleteBadge(badgeId)
7 .then(() => {
8 console.log("Badge deleted");
9 })
10 .catch((error) => {
11 console.error(error);
12 });
13}