function handleClick(event, check = true) {
  event.preventDefault()
  const text = check ? 'Marcar como lida' : 'Excluir'
  const slug = check ? 'check' : 'delete'

  const roomId = document.querySelector('#room-id').dataset.id
  const questionId = event.target.dataset.id

  const form = document.querySelector('.modal form')
  form.setAttribute('action', `/question/${roomId}/${questionId}/${slug}`)

  modalTitle.innerHTML = `${text} esta pergunta?`
  modalDescription.innerHTML = `Tem certeza que deseja ${text.toLowerCase()} esta pergunta?`
  modalButton.innerHTML = `Sim, ${text.toLowerCase()}`
  check ? modalButton.classList.remove('red') : modalButton.classList.add('red')

  modal.open()
}
// pegar quandos os botoes forem clicados
pegar quandos os botoes forem clicados
pegar quandos os botoes forem clicados
function handleClick(event, check = true) {
  event.preventDefault()
  const text = check ? 'Marcar como lida' : 'Excluir'
  const slug = check ? 'check' : 'delete'
  const roomId = document.querySelector('#room-id').dataset.id
  const questionId = event.target.dataset.id
  const form = document.querySelector('.modal form')
  form.setAttribute('action', `/question/${roomId}/${questionId}/${slug}`)
  modalTitle.innerHTML = `${text} esta pergunta?`
  modalDescription.innerHTML = `Tem certeza que deseja ${text.toLowerCase()} esta pergunta?`
  modalButton.innerHTML = `Sim, ${text.toLowerCase()}`
  check ? modalButton.classList.remove('red') : modalButton.classList.add('red')
  modal.open()
}
function handleClick ( event , check = true ) { event . preventDefault ( ) const text = check ? 'Marcar como lida' : 'Excluir' const slug = check ? 'check' : 'delete' const roomId = document . querySelector ( '#room-id' ) . dataset . id const questionId = event . target . dataset . id const form = document . querySelector ( '.modal form' ) form . setAttribute ( 'action' , ` ${ roomId } ${ questionId } ${ slug } ` ) modalTitle . innerHTML = ` ${ text } ` modalDescription . innerHTML = ` ${ text . toLowerCase ( ) } ` modalButton . innerHTML = ` ${ text . toLowerCase ( ) } ` check ? modalButton . classList . remove ( 'red' ) : modalButton . classList . add ( 'red' ) modal . open ( ) }
pegar quandos os botoes forem clicados
pegar quandos os botoes forem clicados