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.
Override permissions
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';23// Sample galleryId value: 'f7cca0a0-5bb5-44c2-a0f8-6496430b3154'45export async function myDeleteGalleryFunction(galleryId) {6 try {7 const deletedGalleryId = await proGallery.deleteGallery(galleryId);89 console.log('Success! Deleted the gallery:', deletedGalleryId);10 return deletedGalleryId;11 } catch (error) {12 console.error(error);13 // Handle the error14 }15}1617/* Promise resolves to:18 * {19 * "galleryId": "f7cca0a0-5bb5-44c2-a0f8-6496430b3154"20 * }21 */22