 
       (ajax "/api/actions/test" "POST" data (fn [e])))))
 
+(defn wrap-error-alert [callback]
+  (fn [reply]
+    (let [resp (js->clj reply)]
+      (when (= "error" (get resp "result")) (js/alert (get resp "message")))
+      (callback reply))))
+
 
 (defn common-update-callback [msg data reply]
   (let [resp (js->clj reply)]

        (.modal ($ :#iModal) "hide")
        (ajax 
         (str "/api/actions/" action-id) "PUT" 
         data #(common-update-callback "Action don't updated!" data %))))))


(defn delete-action [action-id]
  (.modal ($ :#iModal) "hide")
  (ajax 
   (str "/api/actions/" action-id) "DELETE"
   {} #(common-update-callback "Action don't deleted!" {} %)))




    (ajax
     (str "/api/projects/" project-id) "PUT"
     {:name new-name} 
     (wrap-error-alert #(common-update-callback "Project don't renamed!" {} %)))))

