adding some debug
This commit is contained in:
parent
db6d1cab0a
commit
dc461bcb67
@ -1,6 +1,7 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/domain"
|
||||
@ -10,14 +11,25 @@ import (
|
||||
)
|
||||
|
||||
func (h *Handler) DebugCookies(c echo.Context) error {
|
||||
user, _ := c.Cookie(domain.CookieUser)
|
||||
token, _ := c.Cookie(domain.CookieToken)
|
||||
refresh, _ := c.Cookie(domain.CookieRefreshToken)
|
||||
model := models.DebugCookiesViewModel{}
|
||||
|
||||
model := models.DebugCookiesViewModel{
|
||||
Username: user.Value,
|
||||
Token: token.Value,
|
||||
RefreshToken: refresh.Value,
|
||||
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))
|
||||
}
|
||||
|
@ -5,8 +5,12 @@ import "git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
||||
|
||||
templ Cookies(vm models.DebugCookiesViewModel) {
|
||||
@layout.WithTemplate() {
|
||||
<p>
|
||||
Token: { vm.Token }
|
||||
</p>
|
||||
<p>
|
||||
RefreshToken: { vm.RefreshToken }
|
||||
</p>
|
||||
UserName: { vm.Username }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user