export async function recipeSearch()

in src/service/SearchService.ts [39:55]


export async function recipeSearch(params:RecipeSearchParams):Promise<RecipeSearchResponse> {
  const endpoint = baseUrl + "/search";

  const response = await fetch(endpoint, {
    method: "POST",
    body: JSON.stringify(params),
    headers: {
      'Content-Type': 'application/json'
    }
  });
  if(response.status!==200) {
    throw new Error(`Could not search: server returned ${response.status}`);
  } else {
    const rawData = await response.json();
    return RecipeSearchResponse.parse(rawData);
  }
}