parent
97bef0257e
commit
c8a3d64918
14 changed files with 315 additions and 57 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"github.com/gorilla/sessions"
|
||||
"github.com/labstack/echo-contrib/session"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/mikestefanello/pagoda/pkg/log"
|
||||
)
|
||||
|
||||
// Type is a message type
|
||||
|
|
@ -79,7 +80,9 @@ func Get(ctx echo.Context, typ Type) []string {
|
|||
func getSession(ctx echo.Context) (*sessions.Session, error) {
|
||||
sess, err := session.Get(sessionName, ctx)
|
||||
if err != nil {
|
||||
ctx.Logger().Errorf("cannot load flash message session: %v", err)
|
||||
log.Ctx(ctx).Error("cannot load flash message session",
|
||||
"error", err,
|
||||
)
|
||||
}
|
||||
return sess, err
|
||||
}
|
||||
|
|
@ -87,6 +90,8 @@ func getSession(ctx echo.Context) (*sessions.Session, error) {
|
|||
// save saves the flash message session
|
||||
func save(ctx echo.Context, sess *sessions.Session) {
|
||||
if err := sess.Save(ctx.Request(), ctx.Response()); err != nil {
|
||||
ctx.Logger().Errorf("failed to set flash message: %v", err)
|
||||
log.Ctx(ctx).Error("failed to set flash message",
|
||||
"error", err,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue