src/static/js/script.js
/**
 * Handle a sucessful geolocation request.
 *
 * @param {Position} posi
 */
Handle a sucessful geolocation request.
@param {Position} posi
Handle a sucessful geolocation request . @param { Position } posi
function handleLocation(posi) {
  const details = {
    lng: posi.coords.longitude,
    lat: posi.coords.latitude,
    acc: posi.coords.accuracy,
    col: qCheckCollege.checked
  };
  fetch(Flask.url_for("date.form"), {
    method: "POST",
    body: JSON.stringify(details),
    headers: {
      "X-CSRFToken": qCSRF.value,
      "Accept": "application/json",
      "Content-Type": "application/json"
    },
  })
  .then(r => r.text())
  .then(url => window.location = url);
}
function handleLocation ( posi ) { const details = { lng : posi . coords . longitude , lat : posi . coords . latitude , acc : posi . coords . accuracy , col : qCheckCollege . checked } ; fetch ( Flask . url_for ( "date.form" ) , { method : "POST" , body : JSON . stringify ( details ) , headers : { "X-CSRFToken" : qCSRF . value , "Accept" : "application/json" , "Content-Type" : "application/json" } , } ) . then ( r => r . text ( ) ) . then ( url => window . location = url ) ; }
Handle a sucessful geolocation request.
Handle a sucessful geolocation request .
// Collect the info we need into one handy object // Send the info to the back-end and redirect the user // to the proper results page accordingly