Closed harishcm closed 2 years ago
Thanks for digging into this, the fix makes sense to me. I just pushed out an update for the template with the fix included. Let me know if everything looks good.
Thanks for the very quick fix! I've tested out the update and it looks good. Just a slight code style indentation issue at merge
(see below) - but it makes no difference to the functionality. Thanks!
(defn as-transit [opts]
(merge {:format (ajax/transit-request-format
{:writer (transit/writer :json time/time-serialization-handlers)})
:response-format (ajax/transit-response-format
{:reader (transit/reader :json time/time-deserialization-handlers)})}
opts))
Good catch, I'll update the indenting and have it pushed out with the next release.
Hi!
There seems to be a slight issue with the
as-transit
function in the file ajax.cljs when using the+re-frame
profile hint.When using
+re-frame
, day8/re-frame-http-fx gets added as a dependency, and the intended way to make ajax requests appears to be by using the:http-xhrio
effects handler.Using
results in the following error at the browser console:
The problem seems to be that the
:http-xhrio
effects handler is dependent upon theajax-request
API of cljs-ajax,which does not allow using keywords (e.g.:transit
) to specify formats.From the day8/re-frame-http-fx README:
From the cljs-ajax README:
Modifying the
as-transit
function (for the+re-frame
profile) to the following seems to work:For your kind consideration. Many thanks!