Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

fix: added an empty view query params checker and setting it to 'all'

Brian Pham2c97a5a38db2
diff --git a/app/handlers/apiv1/post.go b/app/handlers/apiv1/post.go
index 7d4f41d4f..9fb086be3 100644
--- a/app/handlers/apiv1/post.go
+++ b/app/handlers/apiv1/post.go
@@ -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"),
}