Renaming of rest resources
This commit is contained in:
parent
e6ed2825e2
commit
1487bb73a1
9 changed files with 5 additions and 5 deletions
|
|
@ -1,29 +0,0 @@
|
|||
import type { RecipeModel } from "../../models/RecipeModel"
|
||||
import { get } from "../utils/requests";
|
||||
|
||||
|
||||
/**
|
||||
* Util for handling the recipe api
|
||||
*/
|
||||
// read base url from .env file
|
||||
const BASE_URL = import.meta.env.VITE_API_BASE;
|
||||
|
||||
/**
|
||||
* URL for handling recipes header data
|
||||
*/
|
||||
const RECIPE_URL = `${BASE_URL}/compact-recipe`
|
||||
|
||||
/**
|
||||
* Load list of all recipes
|
||||
* @param searchString Search string for filtering recipeList
|
||||
* @returns Array of recipe
|
||||
*/
|
||||
export async function fetchRecipeList(searchString : string): Promise<RecipeModel[]> {
|
||||
let url : string = RECIPE_URL; // add an s to the base URL as we want to load a list
|
||||
// if there's a search string add it as query parameter
|
||||
if(searchString && searchString !== ""){
|
||||
url +="?search=" + searchString;
|
||||
}
|
||||
const res = await get(url);
|
||||
return res.json();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue