Search.../

deleteUser( )

Deletes an existing user.

Description

The deleteUser() function returns a Promise that resolves when the user with the given ID is deleted.

Syntax

function deleteUser(userId: string): Promise<void>

deleteUser Parameters

NAME
TYPE
DESCRIPTION
userId
string

ID of the user to delete.

Returns

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

Return Type:

Promise<void>

Was this helpful?

Delete a user by ID

Copy Code
1import wixUsersBackend from 'wix-users-backend';
2
3export function deleteUser(userId) {
4 wixUsersBackend.deleteUser(userId)
5 .then( () => {
6 // user has been deleted
7 })
8 .catch( (err) => {
9 // there was an error deleting the user
10 });
11}
Delete the current user

Copy Code
1import wixUsersBackend from 'wix-users-backend';
2
3export function deleteUser() {
4 let user = wixUsersBackend.currentUser;
5
6 wixUsersBackend.deleteUser(user.id)
7 .then( () => {
8 // user has been deleted
9 })
10 .catch( (err) => {
11 // there was an error deleting the user
12 });
13}