Parse ?lang query param in cookie banner config API
Pass the lang parameter from the request URL to the service so the config response returns localized texts and category names for the requested language. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -65,7 +65,9 @@ func (h *Handler) handleGetConfig(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
config, err := h.cookieBannerSvc.GetActiveBannerConfig(r.Context(), bannerID)
|
||||
lang := r.URL.Query().Get("lang")
|
||||
|
||||
config, err := h.cookieBannerSvc.GetActiveBannerConfig(r.Context(), bannerID, lang)
|
||||
if err != nil {
|
||||
if errors.Is(err, cookiebanner.ErrBannerNotFound) {
|
||||
jsonutil.RenderNotFound(w, fmt.Errorf("banner not found"))
|
||||
|
||||
Reference in New Issue
Block a user