📊
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

rename()

rename(id: EntryIdType, newName: string): Promise<PollWithOptions>

Rename a poll.

Parameters:

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

  • newName (string): The new name for the poll.

Returns:

  • A Promise resolving to the updated poll object (PollWithOptions), including information such as the poll ID, updated name, creation date, associated poll type, and options.

Example:

const pollIdToRename = 1;
const newPollName = 'Updated Poll Name';

try {
  const renamedPoll = await pollz.polls.rename(pollIdToRename, newPollName);
  console.log('Poll Renamed:', renamedPoll);
} catch (error) {
  console.error('Failed to rename poll:', error.message);
}

The rename method allows you to change the name of a specific poll identified by its unique ID (id). Provide the new name for the poll using the newName parameter.

The method returns a Promise resolving to the updated poll object (PollWithOptions), which includes details such as the poll ID, updated name, creation date, associated poll type, and the list of options.

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

Previousvote()NextdeleteOne()

Last updated 1 year ago