Update a customer's birthday

A simple form to update a customer's birthday.

<form id="update-dob-form">
  <div>
    <label>Date of Birth</label>
    <input type="text" name="dob" id="dob" value="{{ customer.metafields.custom.rivo.value.dob }}">
  </div>
  <input type="submit" value="Update Date of Birth" />
</form>
<script type="text/javascript">
  document.addEventListener("DOMContentLoaded", function(){
   const form = document.getElementById("update-dob-form");
    form.addEventListener("submit", function(event) {
      event.preventDefault();
      const dob = document.getElementById("dob").value;
      if (dob){
        window.RivoJS.updateCustomerDob(dob).then(function(success){
          if (success){
            alert("Updated the customer's DOB");
          }
        })
      }
    });
  });
</script>