package context import ( "net/http" "lishwist/db" "lishwist/templates" ) type HomeProps struct { Username string Gifts []db.Gift Reference string } func (ctx *Context) Home(w http.ResponseWriter, r *http.Request) { user := ctx.Auth.ExpectUser(r) gifts, err := user.GetGifts() if err != nil { http.Error(w, "An error occurred while fetching your wishlist :(", http.StatusInternalServerError) return } p := HomeProps{Username: user.Name, Gifts: gifts, Reference: user.Reference} templates.Execute(w, "home.gotmpl", p) }