feat(recipe): añadida función para eliminar una receta en stores y services

parent 27dbf910
...@@ -25,5 +25,9 @@ export const recipeService = { ...@@ -25,5 +25,9 @@ export const recipeService = {
create: async (recipeData) => { create: async (recipeData) => {
const response = await api.post('/recipe', recipeData); const response = await api.post('/recipe', recipeData);
return response.data; return response.data;
},
delete: async (id) => {
const response = await api.delete(`/recipe/${id}`);
return response.data;
} }
} }
\ No newline at end of file
...@@ -62,6 +62,14 @@ export const useRecipeStore = defineStore('recipe', { ...@@ -62,6 +62,14 @@ export const useRecipeStore = defineStore('recipe', {
console.error('Error al crear la receta:', error); console.error('Error al crear la receta:', error);
throw error; throw error;
} }
},
async delete(id) {
try {
await recipeService.delete(id);
} catch {
console.error('Error al eliminar la receta', error);
throw error;
}
} }
} }
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment