mirror of
https://github.com/AlecM33/Werewolf.git
synced 2025-12-26 07:47:50 +01:00
further incomplete redis draft
This commit is contained in:
@@ -66,7 +66,7 @@ router.get('/:code/availability', function (req, res) {
|
||||
});
|
||||
});
|
||||
|
||||
router.patch('/:code/players', function (req, res) {
|
||||
router.patch('/:code/players', async function (req, res) {
|
||||
if (
|
||||
req.body === null
|
||||
|| !validateAccessCode(req.body.accessCode)
|
||||
@@ -77,7 +77,7 @@ router.patch('/:code/players', function (req, res) {
|
||||
) {
|
||||
res.status(400).send();
|
||||
} else {
|
||||
const game = gameManager.activeGameRunner.activeGames.get(req.body.accessCode);
|
||||
const game = await gameManager.activeGameRunner.getActiveGame(req.body.accessCode);
|
||||
if (game) {
|
||||
const inUseCookie = gameManager.environment === globals.ENVIRONMENT.PRODUCTION ? req.body.localCookie : req.body.sessionCookie;
|
||||
gameManager.joinGame(game, req.body.playerName, inUseCookie, req.body.joinAsSpectator).then((data) => {
|
||||
@@ -101,7 +101,7 @@ router.patch('/:code/restart', function (req, res) {
|
||||
) {
|
||||
res.status(400).send();
|
||||
} else {
|
||||
const game = gameManager.activeGameRunner.activeGames.get(req.body.accessCode);
|
||||
const game = gameManager.activeGameRunner.getActiveGame(req.body.accessCode);
|
||||
if (game) {
|
||||
gameManager.restartGame(game, gameManager.namespace).then((data) => {
|
||||
res.status(200).send();
|
||||
|
||||
Reference in New Issue
Block a user