🤦 Fix report data being assigned to the same object.

This commit is contained in:
Kevin Baensch 2021-04-22 14:34:01 +02:00
parent eced93fdef
commit 8bdcd2c444
Signed by: derped
GPG Key ID: C0F1D326C7626543
1 changed files with 5 additions and 14 deletions

View File

@ -3,22 +3,9 @@
const app = document.getElementById("appContent"); const app = document.getElementById("appContent");
let userdata; let userdata;
load(); load();
const emptyPages = {
"title": {"type": "title"},
"blank": {"type": "blank"},
"report": {
"type": "report",
"days": [ [], [], [], [], [], ],
},
};
let templates; let templates;
// const templates = {
// "blank": (await fetchTemplate("blank"))
// };
// let blank = fetchTemplate("blank").then(b=>{blank=b});
// let blank = fetchTemplate("blank")
async function init() { async function init() {
if (typeof templates === "undefined") { if (typeof templates === "undefined") {
templates = { templates = {
@ -39,7 +26,11 @@ async function init() {
function pageAdd(template) { function pageAdd(template) {
pageNew(template); pageNew(template);
userdata.pages.push(emptyPages[template]); let newPage = {"type": template};
if (template === "report") {
newPage["days"] = [ [], [], [], [], [], ];
}
userdata.pages.push(newPage);
populate(app.children.length); populate(app.children.length);
save(); save();
} }