mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-21 04:26:47 +00:00
Condense some logic
This commit is contained in:
parent
ee82683620
commit
a570354fd4
@ -59,13 +59,8 @@ app.get('/', (req, res) => {
|
||||
|
||||
app.get('/:roomId', (req, res) => {
|
||||
const roomId = req.params.roomId || false;
|
||||
let roomExists = false;
|
||||
|
||||
rooms.forEach( (room) => {
|
||||
if (room._id === roomId) {
|
||||
roomExists = true;
|
||||
}
|
||||
});
|
||||
let roomExists = _.findWhere(rooms, {_id: roomId}) ? true : false;
|
||||
|
||||
if (roomExists) {
|
||||
return res.render('index', {username: shortid.generate()});
|
||||
|
Loading…
x
Reference in New Issue
Block a user