diff options
author | Frédéric Guillot <fred@miniflux.net> | 2019-07-17 21:29:00 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2019-07-17 21:40:03 -0700 |
commit | ac3693562b635aaab4f43ad5d1343aae7ba5b7d2 (patch) | |
tree | db0487e501af59494df550d0ed4b30b4b1bd4327 /ui | |
parent | 99149d9f2a32dd7426c6c2e51762e0895ed8199c (diff) |
Ask for confirmation before flushing history
Diffstat (limited to 'ui')
-rw-r--r-- | ui/history_flush.go | 7 | ||||
-rw-r--r-- | ui/ui.go | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/ui/history_flush.go b/ui/history_flush.go index d0b8f62..e74c5b9 100644 --- a/ui/history_flush.go +++ b/ui/history_flush.go @@ -8,16 +8,15 @@ import ( "net/http" "miniflux.app/http/request" - "miniflux.app/http/response/html" - "miniflux.app/http/route" + "miniflux.app/http/response/json" ) func (h *handler) flushHistory(w http.ResponseWriter, r *http.Request) { err := h.store.FlushHistory(request.UserID(r)) if err != nil { - html.ServerError(w, r, err) + json.ServerError(w, r, err) return } - html.Redirect(w, r, route.Path(h.router, "history")) + json.OK(w, r, "OK") } @@ -45,7 +45,7 @@ func Serve(router *mux.Router, store *storage.Storage, pool *worker.Pool, feedHa // History pages. uiRouter.HandleFunc("/history", handler.showHistoryPage).Name("history").Methods("GET") uiRouter.HandleFunc("/history/entry/{entryID}", handler.showReadEntryPage).Name("readEntry").Methods("GET") - uiRouter.HandleFunc("/history/flush", handler.flushHistory).Name("flushHistory").Methods("GET") + uiRouter.HandleFunc("/history/flush", handler.flushHistory).Name("flushHistory").Methods("POST") // Bookmark pages. uiRouter.HandleFunc("/starred", handler.showStarredPage).Name("starred").Methods("GET") |