Mejoras generales
This commit is contained in:
12
libs/api.js
12
libs/api.js
@@ -15,7 +15,7 @@ async function subirDato(datos) {
|
||||
}
|
||||
const datosParaEnviar = {
|
||||
created_at: datos.datetime,
|
||||
delta_t: 1,
|
||||
//delta_t: 1, // Activar si da problemas con el tiempo
|
||||
field1: datos.paquetes,
|
||||
field2: datos.temperatura,
|
||||
field3: datos.presion,
|
||||
@@ -27,11 +27,6 @@ async function subirDato(datos) {
|
||||
longitude: datos.longitud
|
||||
};
|
||||
|
||||
//console.log(datos);
|
||||
//console.log(datosParaEnviar);
|
||||
|
||||
// Guardar datos en archivo: https://nodejs.org/en/learn/manipulating-files/writing-files-with-nodejs
|
||||
|
||||
peticionesRetrasadas.push(datosParaEnviar);
|
||||
saveDataInFile(datos);
|
||||
}
|
||||
@@ -69,7 +64,7 @@ async function subirDatosDeGolpe(datosParaSubir) {
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
//console.log(data);
|
||||
console.log(data);
|
||||
resultado = true; // Si todo sale bien, devolvemos true
|
||||
})
|
||||
.catch(error => {
|
||||
@@ -100,7 +95,8 @@ async function bucleSubidaDatos() {
|
||||
}
|
||||
|
||||
export {
|
||||
subirDato
|
||||
subirDato,
|
||||
subirDatosDeGolpe
|
||||
}
|
||||
|
||||
bucleSubidaDatos();
|
||||
|
||||
Reference in New Issue
Block a user