INNER CODE UNIT · TypeScript

fetchStaleGame

ekzhang/setwithfriends · functions/src/index.ts:478

export const fetchStaleGame = functions.https.onCall(async (data, context) => {
  if (!context.auth) {
    throw new functions.https.HttpsError(
      "failed-precondition",
      "The function must be called while authenticated.",
    );
  }

  const gameId = data.gameId;
  if (
    !(typeof gameId === "string") ||
    gameId.length === 0 ||
    gameId.length > MAX_GAME_ID_LENGTH
  ) {
    throw new functions.https.HttpsError(
      "invalid-argument",
      "The function must be called with argument `gameId` to be fetched at `/games/:gameId`.",
    );

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…