🤦 Fix report data being assigned to the same object.
This commit is contained in:
parent
eced93fdef
commit
8bdcd2c444
1 changed files with 5 additions and 14 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue