36 lines
780 B
Go
36 lines
780 B
Go
package handlers
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
|
|
"git.jamestombleson.com/jtom38/newsbot-portal/internal/domain"
|
|
"git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
|
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/debug"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
func (h *Handler) DebugCookies(c echo.Context) error {
|
|
model := models.DebugCookiesViewModel{}
|
|
|
|
allCookies := c.Cookies()
|
|
log.Print(allCookies)
|
|
|
|
user, err := c.Cookie(domain.CookieUser)
|
|
if err == nil {
|
|
model.Username = user.Value
|
|
}
|
|
|
|
token, err := c.Cookie(domain.CookieToken)
|
|
if err == nil {
|
|
model.Token = token.Value
|
|
}
|
|
|
|
refresh, err := c.Cookie(domain.CookieRefreshToken)
|
|
if err == nil {
|
|
model.RefreshToken = refresh.Value
|
|
}
|
|
|
|
return Render(c, http.StatusOK, debug.Cookies(model))
|
|
}
|