perf(CreateRecipe): cambio de redirección al crear receta hacia el detalle de la misma

parent 1e334571
...@@ -57,6 +57,7 @@ export const useRecipeStore = defineStore('recipe', { ...@@ -57,6 +57,7 @@ export const useRecipeStore = defineStore('recipe', {
try { try {
const newRecipe = await recipeService.create(recipeData); const newRecipe = await recipeService.create(recipeData);
this.recipe = newRecipe; this.recipe = newRecipe;
return newRecipe.id;
} catch (error) { } catch (error) {
console.error('Error al crear la receta:', error); console.error('Error al crear la receta:', error);
throw error; throw error;
......
...@@ -154,8 +154,8 @@ async function handleCreation() { ...@@ -154,8 +154,8 @@ async function handleCreation() {
formData.append(`steps[${index}].description`, step.description); formData.append(`steps[${index}].description`, step.description);
}); });
await recipeStore.create(formData); const newRecipeId = await recipeStore.create(formData);
router.push('/recipes'); router.push(`/recipes/detail/${newRecipeId}`);
} catch (error) { } catch (error) {
// Limpia la imagen y el campo del formulario // Limpia la imagen y el campo del formulario
picture.value = null; picture.value = null;
......
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