send existing cookie on join call

This commit is contained in:
AlecM33
2022-01-25 18:05:35 -05:00
parent 14e158c0b4
commit 2c9e7c14f8
5 changed files with 27 additions and 14 deletions

View File

@@ -254,7 +254,11 @@ class GameManager {
}
};
joinGame = (game, name) => {
joinGame = (game, name, cookie) => {
const matchingPerson = findPersonByField(game, 'cookie', cookie);
if (matchingPerson) {
return Promise.resolve(matchingPerson.cookie);
}
if (isNameTaken(game, name)) {
return Promise.reject(400);
}