You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
428 B
19 lines
428 B
package layout
|
|
|
|
import "net/http"
|
|
|
|
// ViewContext contains per-request metadata needed by layout templates.
|
|
type ViewContext struct {
|
|
Request *http.Request
|
|
Username string
|
|
CSRFToken string
|
|
}
|
|
|
|
// NewViewContext builds a ViewContext from request metadata.
|
|
func NewViewContext(r *http.Request, username, csrfToken string) ViewContext {
|
|
return ViewContext{
|
|
Request: r,
|
|
Username: username,
|
|
CSRFToken: csrfToken,
|
|
}
|
|
}
|