Answer the question
In order to leave comments, you need to log in
How to update data via fetch for only some fields?
Good day.
There is a fetch request:
class getData {
fetch() {
var data = fetch(url, myInit)
.then(status)
.then((data) => data.json())
.catch((error) => {
console.log('error', error)
})
return data;
}
}
var timer = setTimeout(function tick() {
let getAPIData = new getData();
getAPIData.fetch().then(function get(data) {
....
let a = Date.parse(alert.expiry);
let eta = expiry(a);
p2.innerHTML = `${eta}`;
....
}
timer = setTimeout(tick, 1000);
}, 100);
function expiry(ex) {
let now = Date.now() /1000;
let expiry = ex / 1000;
let diff = expiry - now;
let b = fortime(diff) // Просто формат даты
return b
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question