📊
Pollz
  • Introduction
  • Quickstart
  • Guides
    • Initializing your app
    • Create a Poll
    • Vote for a Poll
    • Retrieve a Poll
    • Manage Poll Options
    • Listen to update
    • Anonymous Poll
  • Components
    • React
    • React Native
    • Embedded
  • API Reference
    • init()
    • pollOptions()
      • addOption()
      • deleteOption()
      • renameOption()
    • anonymous
      • createAnonymousToken()
      • getAnonymousPoll()
      • voteAnonymously()
    • polls
      • create()
      • get()
      • getAll()
      • vote()
      • rename()
      • deleteOne()
      • listen()
    • pollTypes
      • getAll()
  • Tooling
    • Typescript
    • React
      • usePoll()
      • usePolls()
      • usePollz()
      • usePollTypes()
      • useAnonymousPoll()
Powered by GitBook
On this page
  1. API Reference
  2. polls

deleteOne()

deleteOne(id: EntryIdType): Promise<void>

Delete a poll.

Parameters:

  • id (EntryIdType): The ID of the poll to be deleted.

Returns:

  • A Promise resolving to void indicating the successful deletion of the specified poll.

Example:

const pollIdToDelete = 1;

try {
  await pollz.polls.deleteOne(pollIdToDelete);
  console.log('Poll Deleted Successfully.');
} catch (error) {
  console.error('Failed to delete poll:', error.message);
}

The deleteOne method allows you to delete a specific poll identified by its unique ID (id). Once deleted, the poll and its associated data, including options and votes, will be permanently removed from the system.

The method returns a Promise resolving to void, indicating the successful deletion of the specified poll.

Note: Ensure that the provided id corresponds to an existing poll in the system.

Previousrename()Nextlisten()

Last updated 1 year ago