Search.../

deleteGallery( )

Developer Preview

Deletes a gallery.

Description

The deleteGallery() function returns a Promise that resolves to the ID of the deleted gallery. When a gallery is deleted, the deleted gallery is no longer returned when calling the listGalleries() function.

This function is restricted and only runs if you elevate permissions using the wix-auth elevate() function.

Warning: Elevating a function allows it to be called by any site visitor. Exercise caution to prevent security vulnerabilities.

Syntax

function deleteGallery(galleryId: string): Promise<DeleteGalleryResponse>

deleteGallery Parameters

NAME
TYPE
DESCRIPTION
galleryId
string

ID of the gallery to delete.

Returns

Return Type:

Promise<
DeleteGalleryResponse
>
NAME
TYPE
DESCRIPTION
galleryId
string

ID of the deleted gallery.

Was this helpful?

Delete a gallery

Copy Code
1import { proGallery } from 'wix-pro-gallery-backend';
2
3// Sample galleryId value: 'f7cca0a0-5bb5-44c2-a0f8-6496430b3154'
4
5export async function myDeleteGalleryFunction(galleryId) {
6 try {
7 const deletedGalleryId = await proGallery.deleteGallery(galleryId);
8
9 console.log('Success! Deleted the gallery:', deletedGalleryId);
10 return deletedGalleryId;
11 } catch (error) {
12 console.error(error);
13 // Handle the error
14 }
15}
16
17/* Promise resolves to:
18 * {
19 * "galleryId": "f7cca0a0-5bb5-44c2-a0f8-6496430b3154"
20 * }
21 */
22