add header filter

This commit is contained in:
kandrusyak
2023-06-23 18:05:01 +03:00
parent eab7ec0c90
commit 7d2aaf40e4
5 changed files with 64 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ func Login(c echo.Context) (err error) {
return
}
data, err := api.PostRequest(config.Env.MSHosts.UsersHost+"/login", u)
data, err := api.PostRequest(config.Env.MSHosts.UsersHost+"/login", u, c.Request().Header)
u.Password = ""
@@ -53,3 +53,17 @@ func Login(c echo.Context) (err error) {
return c.JSON(http.StatusOK, u)
}
func GetCurrentUser(c echo.Context) error {
u := new(model.User)
data, err := api.GetRequest(config.Env.MSHosts.UsersHost+"/me", c.Request().Header)
err = json.Unmarshal(data, &u)
if err != nil {
return c.NoContent(http.StatusBadGateway)
}
return c.JSON(http.StatusOK, u)
}