Skip to content

Commit

Permalink
add query param for saving content through API
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Yrovas committed Sep 1, 2023
1 parent 34f4898 commit eada543
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/api/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,10 @@ func (h *handler) fetchContent(w http.ResponseWriter, r *http.Request) {
return
}

if err := h.store.UpdateEntryContent(entry); err != nil {
json.ServerError(w, r, err)
if request.QueryBoolParam(r, "save", false) {
if err := h.store.UpdateEntryContent(entry); err != nil {
json.ServerError(w, r, err)
}
}

json.OK(w, r, map[string]string{"content": entry.Content, "web_content": entry.WebContent})
Expand Down

0 comments on commit eada543

Please sign in to comment.