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
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ let lastTimeOut = null; ...@@ -22,6 +22,7 @@ let lastTimeOut = null;
const doSave = () => { const doSave = () => {
const data = new FormData(document.forms.namedItem("upload")); const data = new FormData(document.forms.namedItem("upload"));
data.append("from_js", "true");
save.value = "Saving…"; save.value = "Saving…";
postData(location.href, data).then((json) => { postData(location.href, data).then((json) => {
save.value = "Saved"; save.value = "Saved";
......
...@@ -55,7 +55,11 @@ func pageImageDetail(ctx PageContext) http.Handler { ...@@ -55,7 +55,11 @@ func pageImageDetail(ctx PageContext) http.Handler {
if err != nil { if err != nil {
panic(err) 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 return
case "delete": case "delete":
_, err = ctx.Database.Exec("DELETE FROM images WHERE id = $1 AND owner = $2", info.Id, user.Id) _, 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