Skip to content

Commit

Permalink
simple test case for untangled-web/untangled-client#67
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasquinn committed Mar 7, 2017
1 parent 4c60c9d commit ec7d6ae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[org.clojure/clojurescript "1.9.494"]
[commons-io "2.5"]

[navis/untangled-client "0.7.0"]
[navis/untangled-client "0.8.1-SNAPSHOT"]
[untangled/om-css "1.0.0"]
[org.omcljs/om "1.0.0-alpha48"]

Expand Down
14 changes: 13 additions & 1 deletion src/client/untangled_template/ui/main.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
[om-css.core :as css :refer-macros [localize-classnames]]
[untangled.client.mutations :as m]))

(defmethod m/mutate 'test/out [_ _ {:keys [output]}]
{:action (fn [] (println output))})

(defui ^:once MainPage
static u/InitialAppState
(initial-state [this params] {:id :main})
Expand All @@ -18,6 +21,15 @@
(render [this]
(localize-classnames MainPage
(let [{:keys [current-user]} (om/props this)]
(dom/div #js {:class :form} "MAIN PAGE")))))
(dom/div #js {:class :form} "MAIN PAGE")
(dom/button #js {:onClick #(om/transact! this `[(untangled/load {:query [:any1]
:post-mutation test/out
:post-mutation-params {:output 1}})
(untangled/load {:query [:any2]
:post-mutation test/out
:post-mutation-params {:output 2}})
(untangled/load {:query [:any3]
:post-mutation test/out
:post-mutation-params {:output 3}})])} "TEST")))))

(def ui-main (om/factory MainPage))
3 changes: 3 additions & 0 deletions src/server/untangled_template/api/read.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
(defn api-read [{:keys [query request] :as env} disp-key params]
;(let [connection (udb/get-connection survey-database)])
(case disp-key
:any1 {:value 1}
:any2 {:value 2}
:any3 {:value 3}
:logged-in? {:value @m/logged-in?}
:hello-world {:value 42}
:current-user {:value {:id 42 :name "Tony Kay"}}
Expand Down

0 comments on commit ec7d6ae

Please sign in to comment.