lishwist/context/home.go

20 lines
334 B
Go

package context
import (
"net/http"
"lishwist/db"
"lishwist/templates"
)
type HomeProps struct {
Items []string
}
func (ctx *Context) Home(w http.ResponseWriter, r *http.Request) {
user := ctx.Auth.ExpectUser(r)
items := db.GetUserItems(user.Username)
p := HomeProps{Items: items}
templates.Execute(w, "home.gotmpl", p)
}