From eb34607c3e609d58a7db2ea295919bef121f77c8 Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Tue, 6 Dec 2022 07:30:36 -0500 Subject: [PATCH] this works on localhost --- src/Database.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Database.js b/src/Database.js index 762dbad..a552f40 100644 --- a/src/Database.js +++ b/src/Database.js @@ -58,6 +58,10 @@ class Database { } static async createUser(_id) { + if (!this.userdb) { + await this.load(); + } + let user = new UserModel({ name: "Anonymous", _id: _id, @@ -71,6 +75,10 @@ class Database { } static async updateUser(_id, data) { + if (!this.userdb) { + await this.load(); + } + let user = await UserModel.findOne({_id: _id}).exec(); user.name = data.name; @@ -82,6 +90,10 @@ class Database { } static async wipe() { + if (!this.userdb) { + await this.load(); + } + await UserModel.find({}, (err, docs) => { docs.forEach(doc => { doc.remove();