From b48b97191633d0cd717c05fcf898c8ead235e9a2 Mon Sep 17 00:00:00 2001 From: hiimgoodpack Date: Wed, 27 Jan 2021 23:08:45 -0500 Subject: [PATCH] Bug fixing with subscribing to categories --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 2998ade..46dcd3f 100644 --- a/index.js +++ b/index.js @@ -237,7 +237,7 @@ module.exports.categories = { } const data = [ "subscribe", - categoriesID + [categoriesID] ]; socket.send(`42/gateway,${JSON.stringify(data)}`); @@ -293,7 +293,11 @@ module.exports.categories = { } case "clientListUpdate": { const categoryID = data[1].category._id; + if (!categories[categoryID]) + categories[categoryID] = {}; + const callback = categories[categoryID].updateCallback; + if (callback) { categories[categoryID].updateCallback = null; callback(categoryID);