Skip to content
Snippets Groups Projects
Commit 9eba6a8a authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Attempt at autosave

parent 57443a6f
Branches
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@ let lastTimeOut = null;
const doSave = () => {
const data = new FormData(document.forms.namedItem("upload"));
data.append("from_js", "true");
save.value = "Saving…";
postData(location.href, data).then((json) => {
save.value = "Saved";
......
......@@ -55,7 +55,11 @@ func pageImageDetail(ctx PageContext) http.Handler {
if err != nil {
panic(err)
}
http.Redirect(w, r, r.URL.Path, http.StatusFound)
if r.PostFormValue("fromjs") == "true" {
returnJson(w, true)
} else {
http.Redirect(w, r, r.URL.Path, http.StatusFound)
}
return
case "delete":
_, err = ctx.Database.Exec("DELETE FROM images WHERE id = $1 AND owner = $2", info.Id, user.Id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment