Class HandleCreatePoll

Handles the creation of a poll.

This method sends a request to create a poll in the specified room via a socket event. It also handles the response from the server to notify the user whether the poll was created successfully or if there was an error.

The options for creating the poll.

The poll object containing the poll details.

The socket instance for emitting events.

The name of the room where the poll will be created.

Optional function to show alert messages.

Function to update the visibility of the poll modal.

A promise that resolves when the poll is created successfully.

Will handle any errors during the poll creation process silently.

const handleCreatePollService = new HandleCreatePoll();
const pollData = {
question: 'What is your favorite color?',
options: ['Red', 'Blue', 'Green'],
};
await handleCreatePollService.handleCreatePoll({
poll: pollData,
socket: socketInstance,
roomName: 'room1',
showAlert: ({ message, type }) => {
console.log(`Alert: ${message} - Type: ${type}`);
},
updateIsPollModalVisible: (isVisible) => {
console.log('Poll modal visibility:', isVisible);
},
});

Constructors

Methods

Constructors

Methods

MMNEPVFCICPMFPCPTTAAATR