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