login response dto added

This commit is contained in:
nquidox 2025-09-09 23:18:07 +03:00
parent 0fdc00e2cc
commit a6ed067478
2 changed files with 8 additions and 2 deletions

View file

@ -164,7 +164,7 @@ func (co *controller) delete(c *gin.Context) {
// @Tags Users - auth // @Tags Users - auth
// @Accept json // @Accept json
// @Param body body Login true "логин" // @Param body body Login true "логин"
// @Success 200 // @Success 200 {object} LoginResponse
// @Failure 400 {object} responses.ErrorResponse400 // @Failure 400 {object} responses.ErrorResponse400
// @Failure 500 {object} responses.ErrorResponse500 // @Failure 500 {object} responses.ErrorResponse500
// @Router /user/login [post] // @Router /user/login [post]
@ -183,7 +183,6 @@ func (co *controller) login(c *gin.Context) {
return return
} }
c.Header("access-token", response.AccessToken)
c.SetCookie( c.SetCookie(
response.RefreshCookie.Name, response.RefreshCookie.Name,
response.RefreshCookie.Value, response.RefreshCookie.Value,
@ -193,6 +192,9 @@ func (co *controller) login(c *gin.Context) {
response.RefreshCookie.Secure, response.RefreshCookie.Secure,
response.RefreshCookie.HttpOnly, response.RefreshCookie.HttpOnly,
) )
c.JSON(http.StatusOK, LoginResponse{AccessToken: response.AccessToken})
log.Debug("User | Successfully logged in")
} }
// @Summary Логаут // @Summary Логаут

View file

@ -21,3 +21,7 @@ type Login struct {
Email string `json:"email"` Email string `json:"email"`
Password string `json:"password"` Password string `json:"password"`
} }
type LoginResponse struct {
AccessToken string `json:"access_token"`
}