export async function exitGameAction()

in app/actions/exit-game.ts [24:36]


export async function exitGameAction({gameId, tokens}: {gameId: string, tokens: Tokens}) {
  const authUser = await validateTokens(tokens);

  // Parse request (throw an error if not correct)
  GameIdSchema.parse(gameId);

  const gameRef = await gamesRef.doc(gameId);

  // update database to exit the game
  await gameRef.update({
    [`players.${authUser.uid}`]: FieldValue.delete(),
  });
}