implement basic login
This commit is contained in:
parent
bdd90b50d9
commit
7a6f5b5bcd
18 changed files with 222 additions and 35 deletions
29
frontend/src/api/points/CompactRecipePoint.ts
Normal file
29
frontend/src/api/points/CompactRecipePoint.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import type { Recipe } from "../../types/recipe"
|
||||
import { get, postJson, putJson } 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<Recipe[]> {
|
||||
let url : string = RECIPE_URL;
|
||||
// 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