                                                 :aria-label "OK"
                                                 :class "close"
                                                 :on-click #(do (.preventDefault %)
-                                                             (delete-endorsement id user_badge_id state))
+                                                             (delete-endorsement id user_badge_id state init-user-badge-endorsement))
                                                 }
                                        [:i.fa.fa-trash.trash]]]]
                                [:div.panel-body

                (when (= "success" (:status data))
                  (reload-fn state)))}))

(defn delete-endorsement [id user_badge_id state]
  (ajax/DELETE
    (path-for (str "/obpv1/badge/endorsement/" user_badge_id "/" id))
    {:handler (fn [data]
                (when (= "success" (:status data))
                  (init-user-badge-endorsement state)))}))


(defn process-text [s state]

    (path-for "/obpv1/badge/user/pending_endorsement/")
    {:handler (fn [data]
                (swap! state assoc :pending data)
                )}))

(defn edit-endorsement [id badge-id content]
  (ajax/POST
    (path-for (str "/obpv1/badge/endorsement/edit/" id))
    {:params {:content content
              :user_badge_id badge-id}
     :handler (fn [data]
                (when (= "success" (:status data))
                  (prn data)
                  ))}))

(defn save-endorsement [state]
  (ajax/POST
