Deletes a resource.
The deleteResource()
function returns a Promise that resolves to the resource ID when the resouce is deleted.
Deleting a resource updates its status
to "DELETED"
.
You cannot delete a resource if it has booked sessions.
Notes:
options.suppressAuth
parameter to true
.Notes:
"business"
in name and tag values. This resource is used for the business's schedule and working hours and cannot be deleted.function deleteResource(resourceId: string, options: Options): Promise<string>;
ID of the resource to delete.
An object representing the available options for deleting a resource.
import { Permissions, webMethod } from "wix-web-module";
import { resources } from "wix-bookings-backend";
export const myDeleteResource = webMethod(Permissions.Anyone, (resourceId) => {
const options = { suppressAuth: true };
return resources
.deleteResource(resourceId, options)
.then((deletedResource) => {
return deletedResource;
})
.catch((error) => {
return error;
});
});
// Resolves to a string containing the deleted resource ID.
// For example: "3f9215e0-7e96-417f-9c16-628e71c77311"
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.