Remove redundant checking

This commit is contained in:
I-Have-An-Issue 2023-02-21 18:02:59 -05:00
parent e92ac41318
commit 115a44d76f
No known key found for this signature in database
GPG Key ID: E55435DEA0825091
1 changed files with 1 additions and 11 deletions

View File

@ -3,18 +3,8 @@ const app = express.Router()
const GameJob = require("../../lib/classes/GameJob.js")
function getGameById(id) {
let game
global.games.forEach((value, key) => {
if (value.placeId == id) game = value
})
return game
}
app.get("/:id", async (request, response) => {
const game = global.games.get(getGameById(request.params.id)?.id)
const game = global.games.get(request.params.id)
if (game) return response.status(400).json({ error: "Game is running" })
const job = new GameJob()