Skip to content

Commit

Permalink
add spinner and hide trash icon
Browse files Browse the repository at this point in the history
  • Loading branch information
fedecarboni7 committed Oct 24, 2024
1 parent b0ad8e7 commit e472657
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion static/js/script-v1.0.7.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,22 @@ function deletePlayer(button) {
playerId = button.getAttribute('id');

if (playerId && confirm("¿Estás seguro de que querés eliminar este jugador?")) {

// Deshabilitar el botón para prevenir múltiples envíos
button.disabled = true;

// Mostrar un spinner encima del botón
const spinner = document.createElement('span');
spinner.className = 'spinner';
spinner.style.marginRight = '0px';

// Ocultar el icono del tacho de basura
const trashIcon = button.querySelector('i.fa-trash');
if (trashIcon) {
trashIcon.style.display = 'none';
}

button.appendChild(spinner);

fetch(`/player/${playerId}`, { method: 'DELETE' })
.then(response => response.text())
.then(() => {
Expand Down

0 comments on commit e472657

Please sign in to comment.