Skip to content
Snippets Groups Projects

Recipe view

Merged Katarzyna Szlejter requested to merge recipe-view into main
2 files
+ 57
33
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 19
12
@@ -352,18 +352,6 @@ export const API = {
@@ -352,18 +352,6 @@ export const API = {
.catch(err => {console.log(err)})
.catch(err => {console.log(err)})
},
},
// addIngredientsToFridge: async (ingredientIds) => {
// const authStore = useAuthStore();
// return axios.delete(`${import.meta.env.VITE_BACKEND_URL}/shoppinglist/purchased`, {
// headers: { Authorization: `Bearer ${authStore.token}`},
// data: { ingredientIds }
// })
// .then((response) => {return response.data})
// .catch(err => {console.log(err)})
// },
addIngredientsToFridge: async (ingredients) => {
addIngredientsToFridge: async (ingredients) => {
const authStore = useAuthStore();
const authStore = useAuthStore();
return axios.put(`${import.meta.env.VITE_BACKEND_URL}/shoppinglist/purchased`, ingredients, {
return axios.put(`${import.meta.env.VITE_BACKEND_URL}/shoppinglist/purchased`, ingredients, {
@@ -390,6 +378,25 @@ export const API = {
@@ -390,6 +378,25 @@ export const API = {
})
})
},
},
 
/**
 
* Remove ingredients from fridge based on a recipe
 
* @param request
 
*/
 
removeIngredientsFromFridge: (request) => {
 
const authStore = useAuthStore();
 
 
axios.put(`${import.meta.env.VITE_BACKEND_URL}/fridge/ingredients`, request,
 
{
 
headers: { Authorization: "Bearer " + authStore.token }
 
})
 
.then((response) => {
 
console.log(response);
 
})
 
.catch((error) => {
 
throw new Error(error);
 
})
 
},
 
/**
/**
* Deletes account from the
* Deletes account from the
Loading