entry_toggle_bookmark.go 631 B

1234567891011121314151617181920212223
  1. // Copyright 2018 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package ui // import "miniflux.app/ui"
  5. import (
  6. "net/http"
  7. "miniflux.app/http/request"
  8. "miniflux.app/http/response/json"
  9. )
  10. // ToggleBookmark handles Ajax request to toggle bookmark value.
  11. func (c *Controller) ToggleBookmark(w http.ResponseWriter, r *http.Request) {
  12. entryID := request.RouteInt64Param(r, "entryID")
  13. if err := c.store.ToggleBookmark(request.UserID(r), entryID); err != nil {
  14. json.ServerError(w, r, err)
  15. return
  16. }
  17. json.OK(w, r, "OK")
  18. }