From a1f09d1f143012570a62bcb2a8fe51c439ad68fb Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Fri, 18 Aug 2023 21:57:47 +0200 Subject: feat: Make mosaic reusable --- pkg/view/media.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'pkg/view') diff --git a/pkg/view/media.go b/pkg/view/media.go index 3124119..d5aace2 100644 --- a/pkg/view/media.go +++ b/pkg/view/media.go @@ -44,7 +44,8 @@ func getPagination(r *http.Request) *repository.Pagination { } if albumIDStr == "" { - page = 0 + id := uint(0) + albumID = &id } else if p, err := strconv.Atoi(albumIDStr); err == nil { id := uint(p) albumID = &id @@ -132,9 +133,9 @@ func (self *MediaView) GetThumbnail(w http.ResponseWriter, r *http.Request) erro } func (self *MediaView) SetMyselfIn(r *ext.Router) { - r.GET("/media/", self.Index) - r.POST("/media/", self.Index) + r.GET("/media", self.Index) + r.POST("/media", self.Index) - r.GET("/media/image/", self.GetImage) - r.GET("/media/thumbnail/", self.GetThumbnail) + r.GET("/media/image", self.GetImage) + r.GET("/media/thumbnail", self.GetThumbnail) } -- cgit v1.2.3