function postFail(json) {
  let alertArea = document.querySelector('#alert-area')
  alertArea.classList.remove('d-none')
  const ul = document.createElement('ul')
  alertArea.appendChild(ul)
  alertArea = document.querySelector('#alert-area ul')
  alertArea.innerHTML = ''
  for(let value in json){
    if(value === "non_field_errors"){
      json[value].forEach(error =>  alertArea.innerHTML += `<li>${error}</li>`)
    }else{
      alertArea.innerHTML += `<li>${value}: ${json[value]}</li>`
    }
  }
  const btnSubmit = document.querySelector('#btn-submit')
  btnSubmit.disabled = false

}
// Function to deal with errors on post credentials
Function to deal with errors on post credentials
Function to deal with errors on post credentials
function postFail(json) {
  let alertArea = document.querySelector('#alert-area')
  alertArea.classList.remove('d-none')
  const ul = document.createElement('ul')
  alertArea.appendChild(ul)
  alertArea = document.querySelector('#alert-area ul')
  alertArea.innerHTML = ''
  for(let value in json){
    if(value === "non_field_errors"){
      json[value].forEach(error =>  alertArea.innerHTML += `<li>${error}</li>`)
    }else{
      alertArea.innerHTML += `<li>${value}: ${json[value]}</li>`
    }
  }
  const btnSubmit = document.querySelector('#btn-submit')
  btnSubmit.disabled = false
}
function postFail ( json ) { let alertArea = document . querySelector ( '#alert-area' ) alertArea . classList . remove ( 'd-none' ) const ul = document . createElement ( 'ul' ) alertArea . appendChild ( ul ) alertArea = document . querySelector ( '#alert-area ul' ) alertArea . innerHTML = '' for ( let value in json ) { if ( value === "non_field_errors" ) { json [ value ] . forEach ( error => alertArea . innerHTML += ` ${ error } ` ) } else { alertArea . innerHTML += ` ${ value } ${ json [ value ] } ` } } const btnSubmit = document . querySelector ( '#btn-submit' ) btnSubmit . disabled = false }
Function to deal with errors on post credentials
Function to deal with errors on post credentials