diff --git a/src/modules/index/index.go b/src/modules/index/index.go index 17942b5..4189ca2 100644 --- a/src/modules/index/index.go +++ b/src/modules/index/index.go @@ -19,11 +19,17 @@ func SetupRoutes(g *echo.Group) { } func indexPage(c echo.Context) error { + refreshQuery := c.QueryParam("refresh") + sessionToken, navidromeUrl := utils.Credentials(c) albums, err := getRandomAlbums(sessionToken, navidromeUrl, 10) if err != nil { return c.HTML(http.StatusBadRequest, fmt.Sprintf("%s", err)) } + if refreshQuery == "true" { + return utils.RenderTempl(c, http.StatusOK, RandomAlbumsFragment(albums)) + } + return utils.RenderTempl(c, http.StatusOK, IndexTempl(albums)) } diff --git a/src/modules/index/index.templ b/src/modules/index/index.templ index a5002ba..8aa5c61 100644 --- a/src/modules/index/index.templ +++ b/src/modules/index/index.templ @@ -3,6 +3,7 @@ package index import ( "acide/src/utils" "fmt" + "strconv" ) templ IndexTempl(albums []utils.Album) { @@ -15,17 +16,33 @@ templ IndexTempl(albums []utils.Album) { Albums -