Commit 9f6ee97a by Billy Larru

implementado array de promesas

parent 5f36ddb0
...@@ -192,56 +192,6 @@ function guardarCambios() { ...@@ -192,56 +192,6 @@ function guardarCambios() {
} }
}); });
// let mrd = {
// id: 1,
// sede_descripcion: "ARENALES",
// asistencia_entrada: "10:00",
// asistencia_salida: "22:22"
// };
//
// ajaxWebService.patch("http://sistem16:666/proyeccion/1", mrd)
// setInterval(() => {
// console.log(moment().format("YYYY/DD/MM HH:MM:SS s"))
// }, 500)
// let timer1 = () => {
// return new Promise((resolve, reject) => {
// resolve(ajaxWebService.get("https://yts.am/api/v2/list_movies.json"))
// });
// }
//
// let timer2 = () => {
// return new Promise((resolve, reject) => {
// let mrd = {
// id: 2,
// sede_descripcion: "ARENALES",
// asistencia_entrada: "10:00",
// asistencia_salida: "22:22"
// };
//
// resolve(ajaxWebService.get("https://yts.am/api/v2/list_movies.json?sort=seeds&limit=15"))
// })
// }
// Promise.all([ajaxWebService.get("https://yts.am/api/v2/list_movies.json"), ajaxWebService.get("https://yts.am/api/v2/list_movies.json?sort=seeds&limit=15")])
// .then((value) => {
// console.log(`FIN`, moment().format("YYYY/DD/MM HH:MM:SS s"))
// debugger;
// })
Promise.all(dataRequest.map(p => ajaxWebService.patch(`${URI_POLICIA_PROYECCION}/${p.id}`, p)))
.then(axios.spread(function (...pms) {
console.log("POR FIN")
}))
let promises = []
swal({ swal({
title: 'Está seguro de guardar los cambios?', title: 'Está seguro de guardar los cambios?',
text: "", text: "",
...@@ -252,30 +202,21 @@ function guardarCambios() { ...@@ -252,30 +202,21 @@ function guardarCambios() {
confirmButtonText: 'Sí, guardar!' confirmButtonText: 'Sí, guardar!'
}).then((result) => { }).then((result) => {
if (result.value) { if (result.value) {
// dataRequest.forEach(d => { let promises = dataRequest.map(p => ajaxWebService.patch(`${URI_POLICIA_PROYECCION}/${p.id}`, p));
// promises.push(ajaxWebService.patch(`${URI_POLICIA_PROYECCION}/${d.id}`, d)) Promise.all(promises)
// }); .then(axios.spread(function (...responses) {
swal(
// Promise.all([get1(), get2()]) {
// .then(function ([acct, perms]) { type: 'success',
// swal( title: '¡Se guardaron los cambios correctamente!',
// { showConfirmButton: false,
// type: 'success', timer: 1500
// title: '¡Se guardaron los cambios correctamente!',
// showConfirmButton: false,
// timer: 1500
// }
// );
// });
} }
}) );
}))
}
// ajaxWebService.patch(URI_POLICIA_PROYECCION, dataRequest).then((response) => { })
//
// });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment