       (do
         (msg/info (:text-progress config))
        (ajax "/api/actions/test" "POST" data
-            (wrap-error-alert
-             (fn [e]
-               (done-callback)
-               (msg/success (:text-done config)))))))))
+            (fn [response]
+              (done-callback)
+              (case (get response "result")
+                "ok" (msg/success (:text-done config))
+                "error" (msg/danger (get response "message")))))))))
 
 (def action-update-error-message "Couldn't update the action. Please file a bug if the issue persists.")
 

            :success callback
            :error error-handler}))

(defn common-update-callback [msg data reply]
  (let [resp (js->clj reply)]
    (when (= "ok" (get resp "result"))
      (state/update-all-view))))

(defn create-new-project-callback [name reply]
  (let [resp (js->clj reply)]
    (when (= "ok" (get resp "result"))
      (state/update-all-view))))


(defn ^:export send-new-project-request []
  (let [name (.-value (.getElementById js/document "project-name-input"))]

        data (build data-pack)]
    (if (s/check schema data)
      (msg/danger default-error-message)
      (ajax
       (str "/api/actions/" (:action-id data-pack)) "PUT"
       data (wrap-error-alert
             #(common-update-callback action-update-error-message data %))))))

(defn delete-action [action-id]
  (.modal ($ :#iModalAddAction) "hide")
