Skip to content

Commit

Permalink
feat(full-app-gourmet): chore return to admin/recipe upon edit save o…
Browse files Browse the repository at this point in the history
…f a single recipe
  • Loading branch information
dylanhitt committed Oct 29, 2024
1 parent 174c60a commit 20c0f75
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/full-app-gourmet/views/admin.recipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (rs Resource) adminRecipes(c fuego.ContextNoBody) (fuego.Templ, error) {
return admin.RecipeList(recipes, searchParams), nil
}

func (rs Resource) adminOneRecipe(c *fuego.ContextWithBody[store.UpdateRecipeParams]) (fuego.Templ, error) {
func (rs Resource) adminOneRecipe(c *fuego.ContextWithBody[store.UpdateRecipeParams]) (any, error) {
id := c.Request().PathValue("id")

if c.Request().Method == "PUT" {
Expand All @@ -55,6 +55,7 @@ func (rs Resource) adminOneRecipe(c *fuego.ContextWithBody[store.UpdateRecipePar
}

c.Response().Header().Set("HX-Trigger", "entity-updated")
return c.Redirect(http.StatusSeeOther, "/admin/recipes")
}

recipe, err := rs.RecipesQueries.GetRecipe(c.Context(), id)
Expand Down

0 comments on commit 20c0f75

Please sign in to comment.