mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-21 12:36:28 +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) => {
|
app.get('/:roomId', (req, res) => {
|
||||||
const roomId = req.params.roomId || false;
|
const roomId = req.params.roomId || false;
|
||||||
let roomExists = false;
|
|
||||||
|
|
||||||
rooms.forEach( (room) => {
|
let roomExists = _.findWhere(rooms, {_id: roomId}) ? true : false;
|
||||||
if (room._id === roomId) {
|
|
||||||
roomExists = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (roomExists) {
|
if (roomExists) {
|
||||||
return res.render('index', {username: shortid.generate()});
|
return res.render('index', {username: shortid.generate()});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user