Return to the previous location when saving/deleting books
This commit is contained in:
parent
7f7cafd1c1
commit
ffbca5e162
1 changed files with 3 additions and 2 deletions
|
@ -47,7 +47,7 @@ func deleteHandler(h handler) {
|
||||||
}
|
}
|
||||||
h.sess.Save(h.w, h.r)
|
h.sess.Save(h.w, h.r)
|
||||||
if isNew {
|
if isNew {
|
||||||
http.Redirect(h.w, h.r, "/new/", http.StatusFound)
|
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
|
||||||
} else {
|
} else {
|
||||||
http.Redirect(h.w, h.r, "/", http.StatusFound)
|
http.Redirect(h.w, h.r, "/", http.StatusFound)
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,7 @@ func saveHandler(h handler) {
|
||||||
if h.db.IsBookActive(id) {
|
if h.db.IsBookActive(id) {
|
||||||
http.Redirect(h.w, h.r, "/book/"+id, http.StatusFound)
|
http.Redirect(h.w, h.r, "/book/"+id, http.StatusFound)
|
||||||
} else {
|
} else {
|
||||||
|
// XXX: I can't use a referer here :(
|
||||||
http.Redirect(h.w, h.r, "/new/", http.StatusFound)
|
http.Redirect(h.w, h.r, "/new/", http.StatusFound)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,5 +217,5 @@ func storeHandler(h handler) {
|
||||||
h.sess.Notify("Store books!", "The books '"+strings.Join(titles, ", ")+"' are stored for public download", "success")
|
h.sess.Notify("Store books!", "The books '"+strings.Join(titles, ", ")+"' are stored for public download", "success")
|
||||||
}
|
}
|
||||||
h.sess.Save(h.w, h.r)
|
h.sess.Save(h.w, h.r)
|
||||||
http.Redirect(h.w, h.r, "/new/", http.StatusFound)
|
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue