LNDHub response for /auth call

This commit is contained in:
Michael Bumann
2022-01-08 18:46:17 +01:00
parent 2223ef41d9
commit cac27f5962

View File

@@ -27,7 +27,11 @@ func (AuthRouter) Auth(c echo.Context) error {
}
if err := c.Validate(&body); err != nil {
return err
return c.JSON(http.StatusBadRequest, echo.Map{
"error": true,
"code": 8,
"message": "Bad arguments",
})
}
if (body.Login == "" || body.Password == "") && body.RefreshToken == "" {
@@ -78,6 +82,7 @@ func (AuthRouter) Auth(c echo.Context) error {
}
return c.JSON(http.StatusOK, echo.Map{
"user": user,
"refresh_token": user.RefreshToken.String,
"access_token": user.AccessToken.String,
})
}