api_key_remove.go 641 B

123456789101112131415161718192021222324
  1. // Copyright 2020 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/html"
  9. "miniflux.app/http/route"
  10. "miniflux.app/logger"
  11. )
  12. func (h *handler) removeAPIKey(w http.ResponseWriter, r *http.Request) {
  13. keyID := request.RouteInt64Param(r, "keyID")
  14. err := h.store.RemoveAPIKey(request.UserID(r), keyID)
  15. if err != nil {
  16. logger.Error("[UI:RemoveAPIKey] %v", err)
  17. }
  18. html.Redirect(w, r, route.Path(h.router, "apiKeys"))
  19. }