How Can I delete data using Swal on reactJs?

Hello everyone I’m using reactjs as frontend and laravel as backend I want to use swal for delete function somtimes it works even if I ckick on No and sometimes it didn’t work at all.
this is my last attempt:

 <span onClick={() => {
                    new Swal({
                      title: `Are you sure you want to delete ${item.visit_name}?`,
                      text: "You will not be able to recover your data!",
                      type: "warning",
                      showCancelButton: true,
                      confirmButtonColor: "#DD6B55",
                      isConfirmed: <button onClick={()=>deleteOperation(item.visit_name)}/>,
                      closeOnConfirm: false
                    })  }} >
                    <Trash2 size={20} color="red" />
                  </span>

This is how I consume the api :

  async function deleteOperation(id) {
    let result = await fetch(`${API_ENDPOINT}/api/deleteVisitor/` + id, {
      method: "DELETE"

    });
    result = await result.json()

    getData();

  }

thanks in advance for anyone will try to help mee