From 840b6e20699771049d605a5ad3677e2b5f37c2dd Mon Sep 17 00:00:00 2001 From: MrMasrozYTLIVE <61359286+MrMasrozYTLIVE@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:09:58 +0300 Subject: [PATCH] Fixed removing rooms --- app.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 5306609..244be34 100644 --- a/app.js +++ b/app.js @@ -278,14 +278,15 @@ function leaveRoom() { if (roomItem) { roomItem.remove(); } + + config.rooms = config.rooms.filter(e => e !== currentRoom.topic); + writeConfigToFile("./config.json"); + currentRoom.destroy(); currentRoom = null; } document.querySelector('#chat').classList.add('hidden'); document.querySelector('#setup').classList.remove('hidden'); - - config.rooms = config.rooms.filter(e => e !== currentRoom.topic); - writeConfigToFile("./config.json"); } function sendMessage(e) { @@ -438,7 +439,6 @@ function toggleSetupView() { } function writeConfigToFile(filePath) { - console.debug(config) fs.writeFile(filePath, JSON.stringify(config), (err) => { if (err) return console.error(err); console.log("File has been created");