ch8.1
This commit is contained in:
@@ -70,7 +70,9 @@ func (app *application) snippetView(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (app *application) snippetCreate(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("Display the form for creating a new snippet..."))
|
||||
data := app.newTemplateData(r)
|
||||
|
||||
app.render(w, http.StatusOK, "create.tmpl", data)
|
||||
}
|
||||
|
||||
func (app *application) snippetCreatePost(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -83,5 +85,5 @@ func (app *application) snippetCreatePost(w http.ResponseWriter, r *http.Request
|
||||
app.serverError(w, err)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, fmt.Sprintf("/snippet/view?id=%d", id), http.StatusSeeOther)
|
||||
http.Redirect(w, r, fmt.Sprintf("/snippet/view/%d", id), http.StatusSeeOther)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user