async fetchRecipes()

in lib/nimbusRecipeCollection.ts [68:91]


  async fetchRecipes(): Promise<Array<NimbusRecipe>> {
    // XXX should really be using URL.parse and URLSearchParams to manage all
    // this stuff
    let experimenterUrl = `${process.env.EXPERIMENTER_API_PREFIX}?status=Live&application=${this.platform}`;
    if (this.isCompleted) {
      // XXX rename isCompleted to isComplete for consistency
      experimenterUrl = `${process.env.EXPERIMENTER_API_PREFIX}?status=Complete&application=${this.platform}`;
    }

    // console.log("experimenterURL = ", experimenterUrl)
    const response = await fetch(experimenterUrl, {
      credentials: "omit",
    });
    // console.log("response = ", response)
    const experiments: NimbusExperiment[] = await response.json();

    // console.log('returned experiments', experiments)
    this.recipes = experiments.map(
      (nimbusExp: NimbusExperiment) =>
        new NimbusRecipe(nimbusExp, this.isCompleted),
    );

    return this.recipes;
  }