Cleanup webhandlers.GetMembre

Remplacer data.NewApiClient() -> data.NewApiClientFromViper()

Cleanup comments
This commit is contained in:
Victor Lacasse-Beaudoin 2023-06-02 02:46:08 -04:00
parent 80a0260021
commit 6d010c5009

View file

@ -6,7 +6,6 @@ import (
"git.agecem.com/agecem/bottin/v4/data" "git.agecem.com/agecem/bottin/v4/data"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/spf13/viper"
) )
func GetIndex(c echo.Context) error { func GetIndex(c echo.Context) error {
@ -14,30 +13,10 @@ func GetIndex(c echo.Context) error {
} }
func GetMembre(c echo.Context) error { func GetMembre(c echo.Context) error {
apiClientKey := viper.GetString("web.api.key") apiClient := data.NewApiClientFromViper()
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)
membreID := c.QueryParam("membre_id") membreID := c.QueryParam("membre_id")
/*
// TODO
log.Printf("Requesting membreID: [%s]", membreID)
*/
membre, err := apiClient.GetMembre(membreID) membre, err := apiClient.GetMembre(membreID)
if err != nil { if err != nil {
return c.Render(http.StatusBadRequest, "index-html", struct { return c.Render(http.StatusBadRequest, "index-html", struct {