features/bootstrapping #1

Merged
jtom38 merged 24 commits from features/bootstrapping into main 2024-06-02 19:55:25 -07:00
2 changed files with 23 additions and 7 deletions
Showing only changes of commit dc461bcb67 - Show all commits

View File

@ -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))
} }

View File

@ -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 }
} }
} }