send Data to Server
This commit is contained in:
parent
8a1a7d19b5
commit
a9cad34e71
|
@ -192,10 +192,26 @@ function saveActualTopicName() {
|
|||
function saveActualTopic() {
|
||||
//save it to LocalStorage
|
||||
localStorage.setItem("actualTopic", JSON.stringify(actualTopic))
|
||||
|
||||
//save it to Server
|
||||
fetch(document.URL + "dataCollector/dataCollector.php", {
|
||||
method: 'POST',
|
||||
headers: { 'Content-type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
"lastSave": new Date().getTime(),
|
||||
"timeWatchM": sumForWatch(actualTopic.watches[0]),
|
||||
"timeWatchW": sumForWatch(actualTopic.watches[1]),
|
||||
"timeWatchD": sumForWatch(actualTopic.watches[2]),
|
||||
"countWatchM": countForWatch(actualTopic.watches[0]),
|
||||
"countWatchW": countForWatch(actualTopic.watches[1]),
|
||||
"countWatchD": countForWatch(actualTopic.watches[2]),
|
||||
"id": actualTopic.id,
|
||||
"watches": actualTopic.watches
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function saveClosedTopics() {
|
||||
//save it to LocalStorage
|
||||
localStorage.setItem("closedTopics", JSON.stringify(closedTopics))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue