ch5.5
This commit is contained in:
@@ -39,9 +39,10 @@ func (app *application) home(w http.ResponseWriter, r *http.Request) {
|
||||
app.serverError(w, err)
|
||||
return
|
||||
}
|
||||
app.render(w, http.StatusOK, "home.tmpl", &templateData{
|
||||
Snippets: snippets,
|
||||
})
|
||||
data := app.newTemplateData(r)
|
||||
data.Snippets = snippets
|
||||
|
||||
app.render(w, http.StatusOK, "home.tmpl", data)
|
||||
}
|
||||
|
||||
func (app *application) snippetView(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -60,9 +61,10 @@ func (app *application) snippetView(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
return
|
||||
}
|
||||
app.render(w, http.StatusOK, "view.tmpl", &templateData{
|
||||
Snippet: snippet,
|
||||
})
|
||||
data := app.newTemplateData(r)
|
||||
data.Snippet = snippet
|
||||
|
||||
app.render(w, http.StatusOK, "view.tmpl", data)
|
||||
}
|
||||
|
||||
func (app *application) snippetCreate(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user