parcoursmob/handlers/application/conseillers.go

30 lines
616 B
Go

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())
}