Deletes a badge.
The deleteBadge()
function returns a Promise that resolves when
the specified badge is deleted.
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.
function deleteBadge(badgeId: string): Promise<void>;
ID of the badge to delete.
import { Permissions, webMethod } from "wix-web-module";
import { badges } from "wix-members-backend";
export const myDeleteBadgeFunction = webMethod(Permissions.Anyone, () => {
const badgeId = "95fad9e6-d4dc-4d84-98a2-ae8660cce599";
return badges
.deleteBadge(badgeId)
.then(() => {
console.log("Badge deleted");
})
.catch((error) => {
console.error(error);
});
});
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.