prefix for cookie path
This commit is contained in:
parent
404a52473d
commit
07c8a5bf35
3 changed files with 14 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package user
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"merch-parser-api/internal/interfaces"
|
||||
|
|
@ -32,7 +33,7 @@ func (h *Handler) RegisterRoutes(r *gin.RouterGroup, authMW gin.HandlerFunc) {
|
|||
userGroup.DELETE("/", authMW, h.controller.delete)
|
||||
|
||||
//auth
|
||||
h.controller.authPath = "/user/auth"
|
||||
h.controller.authPath = fmt.Sprintf("%s/user/auth", h.apiPrefix)
|
||||
authGroup := userGroup.Group("/auth")
|
||||
|
||||
authGroup.POST("/login", h.controller.login)
|
||||
|
|
@ -213,6 +214,7 @@ func (co *controller) logout(c *gin.Context) {
|
|||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, responses.ErrorResponse400{Error: err.Error()})
|
||||
log.WithError(err).Error("User | Failed to get refresh cookie")
|
||||
return
|
||||
}
|
||||
|
||||
refreshUuid := cookie.Value
|
||||
|
|
@ -239,6 +241,7 @@ func (co *controller) refresh(c *gin.Context) {
|
|||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, responses.ErrorResponse400{Error: err.Error()})
|
||||
log.WithError(err).Error("User | Failed to get refresh cookie")
|
||||
return
|
||||
}
|
||||
|
||||
refreshUuid := cookie.Value
|
||||
|
|
|
|||
|
|
@ -9,12 +9,14 @@ type Handler struct {
|
|||
controller *controller
|
||||
service *service
|
||||
repo UserRepo
|
||||
apiPrefix string
|
||||
}
|
||||
|
||||
type Deps struct {
|
||||
Auth interfaces.Auth
|
||||
DB *gorm.DB
|
||||
Utils interfaces.Utils
|
||||
Auth interfaces.Auth
|
||||
DB *gorm.DB
|
||||
Utils interfaces.Utils
|
||||
ApiPrefix string
|
||||
}
|
||||
|
||||
func NewHandler(deps Deps) *Handler {
|
||||
|
|
@ -26,5 +28,6 @@ func NewHandler(deps Deps) *Handler {
|
|||
controller: c,
|
||||
service: s,
|
||||
repo: r,
|
||||
apiPrefix: deps.ApiPrefix,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue