Refactoring http/main into http router
All checks were successful
cicd / ci (push) Successful in 1m39s

This commit is contained in:
bel
2024-07-20 09:27:26 -06:00
parent ddc95c9054
commit b6c6e83443
3 changed files with 347 additions and 371 deletions

View File

@@ -17,11 +17,11 @@
}
function callback(responseBody, responseStatus) {
}
var f = String(window.location).split("/transactions.html")[1]
if (!f) {
f = "/ledger.dat"
}
f = "." + f
//var f = String(window.location).split("/transactions.html")[1]
//if (!f) {
// f = "/ledger.dat"
//}
//f = "." + f
function init() {
const zeroPad = (num, places) => String(num).padStart(places, '0')
var d = new Date()
@@ -30,10 +30,10 @@
var iframe = document.getElementsByTagName("iframe")[0]
iframe.src = iframe.src.replace("YYYY-MM", replacement)
load(f)
load()
}
function load(f) {
http("GET", "/api/transactions?f="+f, (body, status) => {
function load() {
http("GET", "/api/transactions" /*?f="+f*/, (body, status) => {
var d = JSON.parse(body)
loadBalances(d.balances)
loadDeltas(d.deltas)
@@ -70,7 +70,7 @@
document.getElementById("reg").innerHTML = result
}
function setLastNLines(form) {
http("PUT", "/api/lastnlines?f="+f, (body, status) => {
http("PUT", "/api/lastnlines" /*?f="+f*/, (body, status) => {
if (status == 205) {
init()
}
@@ -79,7 +79,7 @@
}
function loadLastNLines(lastNLines) {
var result = `<form onsubmit="setLastNLines(this); return false;" action="#">`
result += ` <div>${f}</div>`
//result += ` <div>${f}</div>`
result += ` <textarea id="lastNLinesTextarea" name="lastNLines" style="height: 30em;">`
for (var k in lastNLines) {
result += lastNLines[k] + "\n"