sweetalert2 Swal.fire delete confirmation code vue js 3

 const delteUser =  async (id) => {

      Swal.fire({

        title: "Are you sure you want to delete this user?",
        showCancelButton: true,
        confirmButtonText: "Confirm",
        showLoaderOnConfirm: true,
        preConfirm: () => {
          return new Promise<void>((resolve) => {
            setTimeout(() => {
              resolve();
            }, 2000);
          });
        },
        allowOutsideClick: false,
      }).then(async (result) => {
        if (result.isConfirmed === true) {
          const resp = await deleteUser(id);
          console.log(resp)
          loadData();
        }
      });
    };



https://sweetalert2.github.io/

Comments

Popular posts from this blog