diff --git a/project.clj b/project.clj index 24a59e4..193a8be 100644 --- a/project.clj +++ b/project.clj @@ -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"] diff --git a/src/client/untangled_template/ui/main.cljs b/src/client/untangled_template/ui/main.cljs index 1994ed8..2046612 100644 --- a/src/client/untangled_template/ui/main.cljs +++ b/src/client/untangled_template/ui/main.cljs @@ -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}) @@ -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)) diff --git a/src/server/untangled_template/api/read.clj b/src/server/untangled_template/api/read.clj index 1aa7a4c..eab86db 100644 --- a/src/server/untangled_template/api/read.clj +++ b/src/server/untangled_template/api/read.clj @@ -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"}}