From 6d010c5009b3022e968759bb86a1591e63148a23 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 2 Jun 2023 02:46:08 -0400 Subject: [PATCH] Cleanup webhandlers.GetMembre Remplacer data.NewApiClient() -> data.NewApiClientFromViper() Cleanup comments --- web/webhandlers/handlers.go | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/web/webhandlers/handlers.go b/web/webhandlers/handlers.go index 34724f9..732d3e7 100644 --- a/web/webhandlers/handlers.go +++ b/web/webhandlers/handlers.go @@ -6,7 +6,6 @@ import ( "git.agecem.com/agecem/bottin/v4/data" "github.com/labstack/echo/v4" - "github.com/spf13/viper" ) func GetIndex(c echo.Context) error { @@ -14,30 +13,10 @@ func GetIndex(c echo.Context) error { } func GetMembre(c echo.Context) error { - apiClientKey := viper.GetString("web.api.key") - apiClientHost := viper.GetString("web.api.host") - apiClientProtocol := viper.GetString("web.api.protocol") - apiClientPort := viper.GetInt("web.api.port") - - /* - log.Printf(` - apiClientKey: %s - apiClientHost: %s - apiClientProtocol: %s - apiClientPort: %d`, - apiClientKey, apiClientHost, apiClientProtocol, apiClientPort, - ) - */ - - apiClient := data.NewApiClient(apiClientKey, apiClientHost, apiClientProtocol, apiClientPort) + apiClient := data.NewApiClientFromViper() membreID := c.QueryParam("membre_id") - /* - // TODO - log.Printf("Requesting membreID: [%s]", membreID) - */ - membre, err := apiClient.GetMembre(membreID) if err != nil { return c.Render(http.StatusBadRequest, "index-html", struct {