recipe author and stars and a bit of cleanup
This commit is contained in:
parent
c47dac9986
commit
6f43d17ddd
21 changed files with 361 additions and 207 deletions
|
@ -4,6 +4,18 @@ export const getRecipes = async () => {
|
|||
return data;
|
||||
};
|
||||
|
||||
export const getRecipeSteps = async () => {
|
||||
const response = await fetch("http://localhost:3000/recipe-steps");
|
||||
const data = await response.json();
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getRecipeIngredients = async () => {
|
||||
const response = await fetch("http://localhost:3000/recipe-ingredients");
|
||||
const data = await response.json();
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getRecipeById = async (id) => {
|
||||
const response = await fetch(`http://localhost:3000/recipe/${id}`);
|
||||
const data = await response.json();
|
||||
|
@ -19,10 +31,23 @@ export const addRecipe = async (recipeData) => {
|
|||
body: JSON.stringify(recipeData)
|
||||
});
|
||||
const data = await response.json();
|
||||
console.log(data)
|
||||
console.log(data);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const setDBStars = async (id, stars) => {
|
||||
console.log(JSON.stringify({ id: id, stars: stars }))
|
||||
// return
|
||||
const response = await fetch("http://localhost:3000/set-stars", {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ id: id, stars: stars })
|
||||
});
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
export const deleteRecipe = async (id) => {
|
||||
console.log(id)
|
||||
// return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue