Yōten: A social tracker for your language learning journey built on the atproto.

feat(views/login): remove need for user to be passed through #24

merged opened by brookjeynes.dev targeting master from push-xlxvwwpkrpwv
Labels

None yet.

Participants 1
AT URI
at://did:plc:4mj54vc4ha3lh32ksxwunnbh/sh.tangled.repo.pull/3m3cf3hayae22
-18
Diff #0
-16
internal/server/handlers/login.go
··· 8 8 9 9 "github.com/posthog/posthog-go" 10 10 11 - "yoten.app/internal/clients/bsky" 12 11 ph "yoten.app/internal/clients/posthog" 13 12 "yoten.app/internal/server/htmx" 14 13 "yoten.app/internal/server/views" 15 - "yoten.app/internal/types" 16 14 ) 17 15 18 16 func (h *Handler) Login(w http.ResponseWriter, r *http.Request) { ··· 20 18 21 19 switch r.Method { 22 20 case http.MethodGet: 23 - var user *types.User 24 - oauth := h.Oauth.GetUser(r) 25 - if oauth != nil { 26 - bskyProfile, err := bsky.GetBskyProfile(oauth.Did) 27 - if err != nil { 28 - l.Error("failed to get bsky profile", "err", err) 29 - } 30 - user = &types.User{ 31 - OauthUser: *oauth, 32 - BskyProfile: bskyProfile, 33 - } 34 - } 35 - 36 21 returnURL := r.URL.Query().Get("return_url") 37 22 views.LoginPage(views.LoginPageParams{ 38 - User: user, 39 23 ReturnUrl: returnURL, 40 24 }).Render(r.Context(), w) 41 25 case http.MethodPost:
-2
internal/server/views/views.go
··· 17 17 } 18 18 19 19 type LoginPageParams struct { 20 - // The current logged in user. 21 - User *types.User 22 20 ReturnUrl string 23 21 } 24 22

History

1 round 0 comments
sign up or login to add to the discussion
brookjeynes.dev submitted #0
1 commit
expand
feat(views/login): remove need for user to be passed through
expand 0 comments
pull request successfully merged