Skip to content

Commit

Permalink
Merge pull request #1175 from npham49/go/apiv1-post-default-view
Browse files Browse the repository at this point in the history
fix: setting default "view" query params to "all"
  • Loading branch information
mattwoberts authored Jul 10, 2024
2 parents 545fd07 + 59e48f7 commit c9e0674
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/handlers/apiv1/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ import (
// SearchPosts return existing posts based on search criteria
func SearchPosts() web.HandlerFunc {
return func(c *web.Context) error {
viewQueryParams := c.QueryParam("view")
if viewQueryParams == "" {
viewQueryParams = "all" // Set default value to "all" if not provided
}
searchPosts := &query.SearchPosts{
Query: c.QueryParam("query"),
View: c.QueryParam("view"),
View: viewQueryParams,
Limit: c.QueryParam("limit"),
Tags: c.QueryParamAsArray("tags"),
}
Expand Down

0 comments on commit c9e0674

Please sign in to comment.