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