cookie MW added
This commit is contained in:
parent
4cf112ad5e
commit
476e5edf38
4 changed files with 17 additions and 2 deletions
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue