Working on Config system (Saving & Loading user data) #3
5
app.js
5
app.js
@ -95,13 +95,16 @@ async function initialize() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const configExists = fs.existsSync("./config.json");
|
||||||
|
if (configExists) {
|
||||||
readConfigFromFile();
|
readConfigFromFile();
|
||||||
config.rooms.forEach(room => {
|
config.rooms.forEach(room => {
|
||||||
addRoomToList(room);
|
addRoomToList(room);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const registerDiv = document.querySelector('#register');
|
const registerDiv = document.querySelector('#register');
|
||||||
if (registerDiv && config.userName !== '') {
|
if (registerDiv && !configExists) {
|
||||||
registerDiv.classList.remove('hidden');
|
registerDiv.classList.remove('hidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user