This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-20
Channels
- # announcements (1)
- # beginners (164)
- # calva (70)
- # cider (26)
- # cljs-dev (6)
- # cljsrn (1)
- # clojars (3)
- # clojure (123)
- # clojure-berlin (1)
- # clojure-dev (5)
- # clojure-ecuador (9)
- # clojure-europe (2)
- # clojure-italy (14)
- # clojure-nl (21)
- # clojure-nlp (5)
- # clojure-portugal (1)
- # clojure-spain (3)
- # clojure-spec (26)
- # clojure-uk (47)
- # clojurescript (17)
- # clr (1)
- # code-reviews (7)
- # core-async (5)
- # cursive (8)
- # data-science (2)
- # datomic (28)
- # emacs (23)
- # events (1)
- # fulcro (43)
- # graalvm (6)
- # graphql (8)
- # immutant (5)
- # jackdaw (17)
- # jobs (1)
- # jobs-discuss (20)
- # joker (3)
- # leiningen (8)
- # luminus (12)
- # off-topic (61)
- # overtone (5)
- # pathom (2)
- # quil (1)
- # re-frame (15)
- # reagent (2)
- # reitit (23)
- # remote-jobs (1)
- # schema (1)
- # shadow-cljs (26)
- # tools-deps (56)
- # vim (4)
Hi! I’m wondering what the best way is to make a level-3 sub that needs to access the db in the second function.
I have a ui element that changes a list of selected filters (companies, in this case). The sub for that is
(rf/reg-sub
:companies
(fn [db _]
(:companies db)))
There is another vector in the app-db, under :facilities
. Each map in that vector includes a company ID.
I’d like a subscription that filters the :facilities vector according to what’s in the :selected-companies
vector.
The trouble is if I don’t know how to get to facilities in the actual subscription function.
(rf/reg-sub
:selected-facilities
(fn [_ _] (rf/subscribe [:selected-companies]))
(fn [companies _]
... how to get to app-db/facilities?
))
I think this should work
(re-frame/reg-sub
:selected-facilities
:<- [:selected-companies]
:<- [:facilities]
(fn [[selected-companies facilities]]
...))
OK, thanks! That’s the first time I’ve seen that syntax… is there someplace I can learn more?
the example in the re-frame docs go into more explanation of that syntax, https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/subs.cljs
Thanks! I’ll have to read the source of the todo example more carefully, that’s very helpful.
Hey everyone, I'm trying to post a cljs map as json with query params using http-fx, but haven't been able to succeed. The error thrown by the API is that it expected JSON, for some reason I think I am sending an empty body. Could someone point me in the right direction please? This is my http-xhrio
map:
Clojure
{:uri ""
:method :post
:format (ajax/json-request-format)
:headers {:authorization (utils/basic-auth username pwd)}
:timeout 10000
:url-params {:foo foo
:bar bar}
:body my-cljs-map
:response-format (ajax/json-response-format {:keywords? true})
:on-success [:success]
:on-failure [:failure]}
clj->js
is not needed when using :params
. Here’s relevant docs from underlying cljs-ajax
https://github.com/JulianBirch/cljs-ajax#getpostput
@UFJ0W255G, You can use this library. https://github.com/LeaveNhA/suluk