diff --git a/web/components/watchlist/card_button.templ b/web/components/watchlist/card_button.templ index 83d41cb..aef6646 100644 --- a/web/components/watchlist/card_button.templ +++ b/web/components/watchlist/card_button.templ @@ -1,6 +1,10 @@ package watchlist -import "fmt" +import ( + "fmt" + + "mal/web/shared" +) templ CardButton( animeID int, @@ -17,7 +21,14 @@ templ CardButton( hx-delete={ string(templ.URL(fmt.Sprintf("/api/watchlist/%d?from=card", animeID))) } } else { hx-post="/api/watchlist/card" - hx-vals={ fmt.Sprintf(`{"anime_id": "%d", "anime_title": "%s", "anime_title_english": "%s", "anime_title_japanese": "%s", "anime_image": "%s", "airing": "%v"}`, animeID, title, titleEnglish, titleJapanese, imageURL, airing) } + hx-vals={ shared.HxVals(map[string]interface{}{ + "anime_id": animeID, + "anime_title": title, + "anime_title_english": titleEnglish, + "anime_title_japanese": titleJapanese, + "anime_image": imageURL, + "airing": airing, + }) } } hx-target="this" hx-swap="outerHTML" diff --git a/web/components/watchlist/dropdown.templ b/web/components/watchlist/dropdown.templ index 22a2a5d..ef34433 100644 --- a/web/components/watchlist/dropdown.templ +++ b/web/components/watchlist/dropdown.templ @@ -1,6 +1,10 @@ package watchlist -import "fmt" +import ( + "fmt" + + "mal/web/shared" +) templ WatchlistDropdown( animeID int, @@ -13,11 +17,11 @@ templ WatchlistDropdown( ) {