                                   :value (when selected-action (name selected-action))
                                   :onChange (partial handle-action-change form)}
                   (map #(dom/option #js {:value %} %)
-                       (actions-for-resource schema selected-resource)))))
+                       (resource->actions schema selected-resource)))))
 
 (defn component [form owner]
   (reify


(defn set-selected-action! [form schema resource action]
  (om/update! form :selected-action action)
  (om/transact! form (fn [m]
                       (merge m (request-for schema resource action)))))

(defn set-selected-resource! [form schema resource]
  (om/update! form :selected-resource resource)
  (set-selected-action! form schema resource (first (actions-for-resource schema resource))))

(defn set-schema! [form schema]
  (om/update! form :schema schema)


(defn request-for [schema resource action]
  (let [prefix "https://api-staging.gocardless.com"
        link (->> (get-in schema [:definitions (keyword resource) :links])
                  (filter #(= (:title %) action))
                  (first))]
    {:method (:method link)
     :url (str prefix (:href link))}))

(defn resource->actions [schema resource]
  (map :title (get-in schema [:definitions (keyword resource) :links])))

(defn read-as-text [file c]
  (let [reader (js/FileReader.)]
