HomeWiki
HomeWiki
  1. Shopping Lists
  • Back to home
  • 1. Themes
  • Layout
    • New Layout
    • Legacy Layout
  • Components
    • Announcement
    • Banner Carousel
    • Banner With Products Carousel
    • Blog Category List
    • Blog List
    • Brand List
    • Brands Carousel
    • Breadcrumb
    • Call To Action
    • Cart
    • Categories List
    • Change Password
    • Checkout
    • Cookie Manager
    • Filter list
    • Footer
    • Forgot Password
    • Form
    • Hero Carousel
    • Icon Block
    • Invitation
    • Last Visited Products
    • Layout
    • Login
    • Map
    • Nav Bar
    • Offer
    • Product Attachments
    • Product Attributes
    • Product Documentation
    • Product Expected
    • Product Modal
    • Products Block
    • Products Carousel
    • Product Single
    • Profile
    • Quote
    • Register
    • Related Products
    • Search
    • Stores
    • Subscribe Newsletter
    • Text with Image
    • Top Bar
    • Video
  • Reusables
    • Getting Started
  • Assets
    • Getting Started
  • SDK
    • Products
      • _findProductsByCategory
      • _findProductsByIds
      • _findProductsByTitle
      • _findProductsByFilter
      • _findProductsByCriteria
      • _findProductsAndCalculate
      • _findProductsThenCalculate
      • _getProductAttributeSet
      • _setLastVisited
    • Categories
      • _findCategoryTreeById
      • _findCategoriesByIds
      • _findCategoryByAlias
      • _findCategoryTreeByAlias
      • _getCategoryContent
    • Collections
      • _getCollectionContent
      • _findCollectionsByIds
      • _findCollectionsByIdsThenCalculate
    • Brands
      • _getBrandContent
      • _findBrandsByIds
    • Cart
      • _addToCartMulti
      • _addToCart
      • _setCart
      • _clearCart
      • _setCartListener
      • _removeFromCart
      • _calculateCart
    • Checkout
      • _startCheckout
      • _updateCheckout
      • _completeCheckout
    • Shopping Lists
      • _getShoppingLists
      • _updateShoppingList
      • _createShoppingList
      • _deleteShoppingList
      • _getShoppingListByAlias
    • Navigation
      • _getFooterMenu
      • _getHeaderMenu
    • Users
      • _getUserById
    • Utils
      • _calculateCurrency
      • _getCurrencySymbol
      • _getCulture
      • _subscribeToNewsletter
      • _findUnitsByIds
  • Vs Code
    • Getting Started
  1. Shopping Lists

_deleteShoppingList

Example Usage of _deleteShoppingList Method#

The _deleteShoppingList method is used to delete an existing shopping list based on its unique identifier (alias). It performs a DELETE request to the server and processes the response using a callback function.

Purpose#

To delete a shopping list from the server by providing its alias, and handle the result through a callback function.

Method Signature#

Parameters#

alias (String): The unique identifier (alias) of the shopping list to be deleted.
Example:
callback (Function): A function to be executed with the result of the delete operation once it's completed.

Usage Steps#

1.
Define a Callback Function:
Create a function that will handle the result of the delete operation. This function will be called with the result as its argument.
2.
Prepare the Alias:
Obtain or define the alias of the shopping list you want to delete.
3.
Invoke the Method:
Call _deleteShoppingList with the alias and the callback function.

Detailed Breakdown#

Delete Request: Sends a DELETE request to /api/ShoppingList/${alias} where ${alias} is the identifier of the shopping list to be deleted.
Callback Execution: Calls the provided callback function with the result of the delete operation. This allows you to handle the outcome of the deletion, such as updating the UI.

Example#

Here's how you might use the _deleteShoppingList method in your application:

Common Use Cases#

Deleting Lists: Useful for scenarios where users can remove shopping lists they no longer need.
UI Updates: Helps in updating parts of the UI that display shopping lists to reflect the deletion.
Data Management: Ensures that deleted shopping lists are removed from the server and are no longer accessible.

Notes#

Alias Validation: Ensure that the alias is valid and exists on the server before making the request to avoid errors.
Error Handling: While this example does not include error handling, consider adding it to manage scenarios where the delete operation fails (e.g., network issues, server errors).
By following this documentation, you can effectively use the _deleteShoppingList method to delete shopping lists from your application and handle the results appropriately.
Previous
_createShoppingList
Next
_getShoppingListByAlias
Built with