mirror of
https://github.com/anotherhadi/iknowyou.git
synced 2026-04-12 00:47:26 +02:00
add demo check
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -137,6 +137,10 @@ func (h *SearchHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// DELETE /searches/{id}
|
||||
func (h *SearchHandler) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
if h.demo {
|
||||
respond.Error(w, http.StatusForbidden, "demo mode: deletions are disabled")
|
||||
return
|
||||
}
|
||||
id := chi.URLParam(r, "id")
|
||||
if err := h.manager.Delete(id); err != nil {
|
||||
respond.Error(w, http.StatusNotFound, err.Error())
|
||||
|
||||
Reference in New Issue
Block a user