I'm a bit more ornery in that I believe that just events are too low-level for app building
re-frame's event system is nice from a perspective of purity, but IMO an event system should be something we strive to build higher-level abstractions on top of
I have a very stupid problem with re-frame-http-fx
, for some reason it does not seem to honor my :format
key and instead always sends the request with *Content-Type:* application/x-www-form-urlencoded;charset=UTF-8
, which means that muuntaja fails to decode the request body. When I send the same payload over curl
manually setting the headers, it works and decodes. Am I doing something wrong or have I misunderstood? If I read the the clj-ajax docs it claims that the default content-type should be edn, but removing the :format
key does nothing.
(reg-event-fx
::submit-session
(fn [_ [_ session]]
{:http-xhrio {:method :post
:uri "<http://localhost:3131/api/submit/session>"
:timeout 8000
:body (util/->transit+json session)
:format (ajax/transit-request-format)
:response-format (ajax/transit-response-format {:keywords? true})
:on-failure [:http/failure]}}))
oh crap, of course, I thought :params
where for query params only. thank you!
I have a complex ui element (like on the level of a small application), distributed as its own library. let's say the purpose of it is to describe properties of a house. in one application I want to use this complex ui element and show multiple data for multiple houses. Is it the best way to pass along the id for the house in every function call (rf dispatch/subscribe) or is there some other, more clever pattern for this? I'd almost like to initiate the view with the id of the house (if this was o-o). Perhaps the best plan is to store the id in a url and get it from the for each sub/dispatch call? unless I'm missing something even simpler
Thanks @p-himik, I'm glad that the documentation certainly has gotten better - it's been a while since I last visited the page. It's interesting to note I had arrived at the exact same best practice concepts without reviewing the documentation. first, that I have to pass the id along and that I can at least package the args into entity specific fns. Perhaps I was looking for yet another level but this at least confirms I'm on the right path