async function editSponsorHandler(event) {
  console.log("editSponsorHandler");
  event.preventDefault();
  const sponsor_name = document.querySelector("#sponsor_name").value;
  const sponsor_address_1 = document.querySelector("#sponsor_address_1").value;
  const sponsor_address_2 = document.querySelector("#sponsor_address_2").value;
  const sponsor_city = document.querySelector("#sponsor_city").value;
  const sponsor_state = document.querySelector("#sponsor_state").value;
  const sponsor_zip = document.querySelector("#sponsor_zip").value;
  const sponsor_relationship = document.querySelector(
    "#sponsor_relationship"
  ).value;
  const sponsor_age = document.querySelector("#sponsor_age").value;
  const sponsor_gender = document.querySelector("#sponsor_gender").value;

  const response = await fetch("/api/edit/sponsor/" + editUACID, {
    method: "PUT",
    body: JSON.stringify({
      sponsor_name: sponsor_name,
      sponsor_address_1: sponsor_address_1,
      sponsor_address_2: sponsor_address_2,
      sponsor_city: sponsor_city,
      sponsor_state: sponsor_state,
      sponsor_zip: sponsor_zip,
      sponsor_relationship: sponsor_relationship,
      sponsor_age: sponsor_age,
      sponsor_gender: sponsor_gender,
    }),

    headers: {
      "Content-Type": "application/json",
    },
  });

  if (response.ok) {
    document.getElementById("edit-sponsor-modal").classList.remove("is-active");
    document.location.replace("/dashboard/" + editUACID);
    console.log(response);
  } else {
    alert(response.statusText);
  }
}
//EDIT SPONSOR TAB AND PUT ROUTE
EDIT SPONSOR TAB AND PUT ROUTE
EDIT SPONSOR TAB AND PUT ROUTE
async function editSponsorHandler(event) {
  console.log("editSponsorHandler");
  event.preventDefault();
  const sponsor_name = document.querySelector("#sponsor_name").value;
  const sponsor_address_1 = document.querySelector("#sponsor_address_1").value;
  const sponsor_address_2 = document.querySelector("#sponsor_address_2").value;
  const sponsor_city = document.querySelector("#sponsor_city").value;
  const sponsor_state = document.querySelector("#sponsor_state").value;
  const sponsor_zip = document.querySelector("#sponsor_zip").value;
  const sponsor_relationship = document.querySelector(
    "#sponsor_relationship"
  ).value;
  const sponsor_age = document.querySelector("#sponsor_age").value;
  const sponsor_gender = document.querySelector("#sponsor_gender").value;
  const response = await fetch("/api/edit/sponsor/" + editUACID, {
    method: "PUT",
    body: JSON.stringify({
      sponsor_name: sponsor_name,
      sponsor_address_1: sponsor_address_1,
      sponsor_address_2: sponsor_address_2,
      sponsor_city: sponsor_city,
      sponsor_state: sponsor_state,
      sponsor_zip: sponsor_zip,
      sponsor_relationship: sponsor_relationship,
      sponsor_age: sponsor_age,
      sponsor_gender: sponsor_gender,
    }),
    headers: {
      "Content-Type": "application/json",
    },
  });
  if (response.ok) {
    document.getElementById("edit-sponsor-modal").classList.remove("is-active");
    document.location.replace("/dashboard/" + editUACID);
    console.log(response);
  } else {
    alert(response.statusText);
  }
}
async function editSponsorHandler ( event ) { console . log ( "editSponsorHandler" ) ; event . preventDefault ( ) ; const sponsor_name = document . querySelector ( "#sponsor_name" ) . value ; const sponsor_address_1 = document . querySelector ( "#sponsor_address_1" ) . value ; const sponsor_address_2 = document . querySelector ( "#sponsor_address_2" ) . value ; const sponsor_city = document . querySelector ( "#sponsor_city" ) . value ; const sponsor_state = document . querySelector ( "#sponsor_state" ) . value ; const sponsor_zip = document . querySelector ( "#sponsor_zip" ) . value ; const sponsor_relationship = document . querySelector ( "#sponsor_relationship" ) . value ; const sponsor_age = document . querySelector ( "#sponsor_age" ) . value ; const sponsor_gender = document . querySelector ( "#sponsor_gender" ) . value ; const response = await fetch ( "/api/edit/sponsor/" + editUACID , { method : "PUT" , body : JSON . stringify ( { sponsor_name : sponsor_name , sponsor_address_1 : sponsor_address_1 , sponsor_address_2 : sponsor_address_2 , sponsor_city : sponsor_city , sponsor_state : sponsor_state , sponsor_zip : sponsor_zip , sponsor_relationship : sponsor_relationship , sponsor_age : sponsor_age , sponsor_gender : sponsor_gender , } ) , headers : { "Content-Type" : "application/json" , } , } ) ; if ( response . ok ) { document . getElementById ( "edit-sponsor-modal" ) . classList . remove ( "is-active" ) ; document . location . replace ( "/dashboard/" + editUACID ) ; console . log ( response ) ; } else { alert ( response . statusText ) ; } }
EDIT SPONSOR TAB AND PUT ROUTE
EDIT SPONSOR TAB AND PUT ROUTE