~netlandish/links

ef619cf0ef97c286be56ec2fc3e94ab1448fcbff — Yader Velasquez 9 months ago 34fb3f6
Fix short/list pagination to considere query param
2 files changed, 10 insertions(+), 6 deletions(-)

M list/routes.go
M short/routes.go
M list/routes.go => list/routes.go +5 -3
@@ 1006,8 1006,10 @@ func (s *Service) ListingList(c echo.Context) error {

	op.Var("orgSlug", org.Slug)

	var tag string
	if c.QueryParam("tag") != "" {
		op.Var("tag", c.QueryParam("tag"))
		tag = c.QueryParam("tag")
		op.Var("tag", tag)
	}

	if c.QueryParam("next") != "" {


@@ 1025,11 1027,11 @@ func (s *Service) ListingList(c echo.Context) error {
	}
	gmap["lists"] = result.Listings.Result
	if result.Listings.PageInfo.HasPrevPage {
		gmap["prevURL"] = links.GetPaginationParams("prev", "", "", result.Listings.PageInfo.Cursor)
		gmap["prevURL"] = links.GetPaginationParams("prev", tag, "", result.Listings.PageInfo.Cursor)
	}

	if result.Listings.PageInfo.HasNextPage {
		gmap["nextURL"] = links.GetPaginationParams("next", "", "", result.Listings.PageInfo.Cursor)
		gmap["nextURL"] = links.GetPaginationParams("next", tag, "", result.Listings.PageInfo.Cursor)
	}
	return gctx.Render(http.StatusOK, "listing_list.html", gmap)
}

M short/routes.go => short/routes.go +5 -3
@@ 113,8 113,10 @@ func (s *Service) LinkShortList(c echo.Context) error {

	op.Var("slug", slug)

	var tag string
	if c.QueryParam("tag") != "" {
		op.Var("tag", c.QueryParam("tag"))
		tag = c.QueryParam("tag")
		op.Var("tag", tag)
	}

	if c.QueryParam("next") != "" {


@@ 154,11 156,11 @@ func (s *Service) LinkShortList(c echo.Context) error {
	}

	if result.LinkShorts.PageInfo.HasPrevPage {
		gmap["prevURL"] = links.GetPaginationParams("prev", "", "", result.LinkShorts.PageInfo.Cursor)
		gmap["prevURL"] = links.GetPaginationParams("prev", tag, "", result.LinkShorts.PageInfo.Cursor)
	}

	if result.LinkShorts.PageInfo.HasNextPage {
		gmap["nextURL"] = links.GetPaginationParams("next", "", "", result.LinkShorts.PageInfo.Cursor)
		gmap["nextURL"] = links.GetPaginationParams("next", tag, "", result.LinkShorts.PageInfo.Cursor)
	}
	return gctx.Render(http.StatusOK, "link_short_list.html", gmap)
}