ch11.6
This commit is contained in:
@@ -10,11 +10,12 @@ import (
|
||||
)
|
||||
|
||||
type templateData struct {
|
||||
CurrentYear int
|
||||
Snippet *models.Snippet
|
||||
Snippets []*models.Snippet
|
||||
Form any
|
||||
Flash string
|
||||
CurrentYear int
|
||||
Snippet *models.Snippet
|
||||
Snippets []*models.Snippet
|
||||
Form any
|
||||
Flash string
|
||||
IsAuthenticated bool
|
||||
}
|
||||
|
||||
func humanDate(t time.Time) string {
|
||||
@@ -27,8 +28,9 @@ var functions = template.FuncMap{
|
||||
|
||||
func (app *application) newTemplateData(r *http.Request) *templateData {
|
||||
return &templateData{
|
||||
CurrentYear: time.Now().Year(),
|
||||
Flash: app.sessionManager.PopString(r.Context(), "flash"),
|
||||
CurrentYear: time.Now().Year(),
|
||||
Flash: app.sessionManager.PopString(r.Context(), "flash"),
|
||||
IsAuthenticated: app.isAuthenticated(r),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user