From 1a784118e91e9e603abf13fc8cbff27371f65f48 Mon Sep 17 00:00:00 2001 From: Yanislav Igonin Date: Fri, 10 Sep 2021 15:06:37 +0300 Subject: [PATCH] fix: add default query for page --- controllers/threads_controller.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/controllers/threads_controller.go b/controllers/threads_controller.go index 232a702..20fca75 100644 --- a/controllers/threads_controller.go +++ b/controllers/threads_controller.go @@ -12,8 +12,7 @@ import ( ) func GetThreads(c *gin.Context) { - // TODO: fix empty query - pageString := c.Query("page") + pageString := c.DefaultQuery("page", "1") page, err := strconv.Atoi(pageString) if err != nil { log.Println("error:", err)