Skip to content

Commit 1d10d9e

Browse files
committed
se añade temporizador para recarga de pagina tras borrar el carrito o terminar la compra
1 parent 5e12869 commit 1d10d9e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

js/carrito.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ const sumaVrTotalProds = () => {
5050
return carrito.reduce((acumulador, item) => acumulador + item.precio, 0);
5151
}
5252

53+
async function recargaPagTiempo() {
54+
await new Promise (resolve => setTimeout(resolve, 5000));
55+
location.reload();
56+
}
57+
5358
const borrarTodoCarrito = () => {
5459
const swalOptions = {
5560
title: "¿Deseas eliminar todo tu carrito de compras?",
@@ -80,6 +85,8 @@ const borrarTodoCarrito = () => {
8085
});
8186
}
8287
});
88+
89+
recargaPagTiempo();
8390
}
8491

8592
const desplegarBotonCarrito = () => {
@@ -238,6 +245,7 @@ const finalizarCompra = () => {
238245
});
239246
}
240247
});
248+
recargaPagTiempo();
241249
}
242250

243251
desplegarGraficosCarrito();

0 commit comments

Comments
 (0)