cookie MW added

This commit is contained in:
nquidox 2025-09-14 19:33:09 +03:00
parent 4cf112ad5e
commit 476e5edf38
4 changed files with 17 additions and 2 deletions

View file

@ -31,3 +31,17 @@ func (r *router) AuthMW() gin.HandlerFunc {
c.Next()
}
}
func (r *router) RefreshMW() gin.HandlerFunc {
return func(c *gin.Context) {
cookie, err := c.Request.Cookie("refresh_uuid")
if err != nil {
c.JSON(http.StatusBadRequest, responses.ErrorResponse400{Error: err.Error()})
log.WithError(err).Error("User | Failed to get refresh cookie")
return
}
c.Set("refresh_uuid", cookie.Value)
c.Next()
}
}