parcoursmob/handlers/application/conseillers.go

30 lines
616 B
Go
Raw Normal View History

2022-12-14 11:18:11 +00:00
package application
import (
"context"
"fmt"
"net/http"
"strings"
mobilityaccounts "git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
)
func (h *ApplicationHandler) ConseillerDisplay(w http.ResponseWriter, r *http.Request) {
adm := strings.Split(r.URL.Path, "/")
adminid := adm[3]
request := &mobilityaccounts.GetAccountRequest{
Id: adminid,
}
resp, err := h.services.GRPC.MobilityAccounts.GetAccount(context.TODO(), request)
if err != nil {
fmt.Println(err)
w.WriteHeader(http.StatusInternalServerError)
return
}
h.Renderer.ConseillerDisplay(w, r, resp.Account.ToStorageType())
}