{"size": 741, "ext": "js", "max_stars_repo_path": "frontend/assets/js/deletequestion.js", "max_stars_repo_name": "uwaelpis/Questack", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "frontend/assets/js/deletequestion.js", "max_issues_repo_name": "uwaelpis/Questack", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "frontend/assets/js/deletequestion.js", "max_forks_repo_name": "uwaelpis/Questack", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.027027027, "max_line_length": 75, "alphanum_fraction": 0.5789473684}
// delete

const deleteBtn = document.getElementById('deleteButton')
const deleteUrl = `../api/v1/questions/${pageUrl}`
deleteBtn.addEventListener('click', (event) => {
  event.preventDefault();

  prompt('Are You Sure You want Delete it?')


  fetch(deleteUrl, {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json',
      Authorization: `${token}`
    }

  }).then((response) => {
    response.json().then((message) => {
      if (response.status !== 200) {
        alert(message.message);
        return null;
      }

      alert(message.message)
      window.setTimeout(() => { window.location.href = 'profile'; }, 1000);
      return null;
    })
  })
    .catch((err) => {
      console.log(err)
    })



})
