From 8bdcd2c4441626d1fc9abd8de21dd88eb4e0410c Mon Sep 17 00:00:00 2001 From: derped Date: Thu, 22 Apr 2021 14:34:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=A6=20Fix=20report=20data=20being=20as?= =?UTF-8?q?signed=20to=20the=20same=20object.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- berichtsheft/assets/js/notebook.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/berichtsheft/assets/js/notebook.js b/berichtsheft/assets/js/notebook.js index dc32bea..35bc5d9 100644 --- a/berichtsheft/assets/js/notebook.js +++ b/berichtsheft/assets/js/notebook.js @@ -3,22 +3,9 @@ const app = document.getElementById("appContent"); let userdata; load(); -const emptyPages = { - "title": {"type": "title"}, - "blank": {"type": "blank"}, - "report": { - "type": "report", - "days": [ [], [], [], [], [], ], - }, -}; let templates; -// const templates = { -// "blank": (await fetchTemplate("blank")) -// }; -// let blank = fetchTemplate("blank").then(b=>{blank=b}); -// let blank = fetchTemplate("blank") async function init() { if (typeof templates === "undefined") { templates = { @@ -39,7 +26,11 @@ async function init() { function pageAdd(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); save(); }