Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Alba María Álvarez
/
front_recipes
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cf9395ab
authored
Sep 05, 2025
by
Alba María Álvarez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat(recipe): añadida función para editar recetas en services y stores
parent
f7d7eede
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
src/services/recipe.js
src/stores/recipeStore.js
src/services/recipe.js
View file @
cf9395ab
import
RecipeDetail
from
'@/views/RecipeDetail.vue'
;
import
api
from
'./api'
;
export
const
recipeService
=
{
...
...
@@ -29,5 +30,9 @@ export const recipeService = {
delete
:
async
(
id
)
=>
{
const
response
=
await
api
.
delete
(
`/recipe/
${
id
}
`
);
return
response
.
data
;
},
update
:
async
(
recipeId
,
newData
)
=>
{
const
response
=
await
api
.
put
(
`/recipe/
${
recipeId
}
`
,
newData
);
return
response
.
data
;
}
}
\ No newline at end of file
src/stores/recipeStore.js
View file @
cf9395ab
...
...
@@ -70,6 +70,15 @@ export const useRecipeStore = defineStore('recipe', {
console
.
error
(
'Error al eliminar la receta'
,
error
);
throw
error
;
}
},
async
update
(
recipeId
,
newData
)
{
try
{
const
updatedRecipe
=
await
recipeService
.
update
(
recipeId
,
newData
);
this
.
recipe
=
updatedRecipe
;
}
catch
(
error
)
{
console
.
error
(
'Error al editar la receta'
,
error
);
throw
error
;
}
}
}
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment