cleanup and bug fixed
upload saved the key of the dict as int not str
This commit is contained in:
parent
4314f97ee3
commit
8d91c63a12
3
app.py
3
app.py
|
@ -128,8 +128,7 @@ def upload():
|
|||
content = alarm["message"]
|
||||
global alarmIndex
|
||||
alarmIndex += 1
|
||||
activeAlarms[alarmIndex] = {'datetime':datetime.strftime(time,"%d.%m.%Y %H:%M"),'message':content}
|
||||
|
||||
activeAlarms[str(alarmIndex)] = {'datetime':datetime.strftime(time,"%d.%m.%Y %H:%M"),'message':content}
|
||||
# ja, wir schreiben einfach das ganze File neu, ist aber einfacher
|
||||
with open('alarms.json', 'w') as f:
|
||||
json.dump(activeAlarms, f, indent=2)
|
||||
|
|
|
@ -67,28 +67,17 @@
|
|||
method: "POST",
|
||||
body: body,
|
||||
});
|
||||
fetch("/processAlarm", {
|
||||
method: "GET"
|
||||
}).then(response => {
|
||||
return response.text();
|
||||
})
|
||||
.then(html => {
|
||||
upcomingAlarms.innerHTML = html
|
||||
})
|
||||
fetch("/processpAlarm", {
|
||||
method: "GET"
|
||||
}).then(response => {
|
||||
return response.text();
|
||||
})
|
||||
.then(html => {
|
||||
previousAlarms.innerHTML = html
|
||||
})
|
||||
reloadAlarms();
|
||||
}
|
||||
async function deleteAlarm(id){
|
||||
const response = await fetch("http://127.0.0.1:5000/deletealarm", {
|
||||
method: "POST",
|
||||
body: id,
|
||||
});
|
||||
reloadAlarms();
|
||||
}
|
||||
|
||||
function reloadAlarms(){
|
||||
fetch("/processAlarm", {
|
||||
method: "GET"
|
||||
}).then(response => {
|
||||
|
@ -105,6 +94,7 @@
|
|||
.then(html => {
|
||||
previousAlarms.innerHTML = html
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function checkAlarms(){
|
||||
|
|
Loading…
Reference in New Issue