From 81a9d7be7c0b5edca7e548d63891265fb27bb14a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 14 Sep 2021 17:12:18 +0300 Subject: [PATCH] Update Datastore class --- src/client/classes/Datastore.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/client/classes/Datastore.js b/src/client/classes/Datastore.js index 89c2751..b18c225 100644 --- a/src/client/classes/Datastore.js +++ b/src/client/classes/Datastore.js @@ -67,6 +67,7 @@ module.exports = class { checkEntry(id){ + this.loadEntry(id); if(!this.map.has(id)){ this.createEntry(id); //this.showEntry(this.getEntry(id)); @@ -85,6 +86,11 @@ module.exports = class { this.saveEntry(id, newData); } + loadEntry(id){ + const json = require(`../../../datastore/` + id + '.json'); + this.map.set(id, json); + } + getEntry(id){ return this.map.get(id); }