This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-19
Channels
- # announcements (41)
- # babashka (25)
- # beginners (11)
- # calva (15)
- # clj-kondo (34)
- # clojure (25)
- # clojure-france (2)
- # clojurescript (69)
- # conjure (1)
- # cursive (23)
- # datalog (3)
- # datomic (4)
- # deps-new (2)
- # emacs (31)
- # helix (1)
- # hoplon (1)
- # lsp (8)
- # luminus (17)
- # malli (5)
- # meander (1)
- # nrepl (7)
- # off-topic (1)
- # polylith (6)
- # portal (3)
- # reitit (15)
- # shadow-cljs (1)
- # xtdb (16)
I’m trying to send a file and other data to the server using http-xhrio (re-frame wrapper around cljs-ajax) like so:
{:http-xhrio {:method :post
:uri (str (endpoint) "/create-ipfs")
:timeout 40000
:format (ajax/json-request-format {:keywords? true})
:response-format (ajax/json-response-format {:keywords? true})
:multipart-params [["token-image" (:token-image db)]
["token-name" (:token-name db)]
["description" (:description db)]]
:on-success [:created-ipfs]
:on-failure [:error-occured]}}
but on the server side, the multipart-params map is empty. How to fix that?https://github.com/JulianBirch/cljs-ajax#getpostput instead of multipart-params you should use :body with js/FormData instead
https://github.com/Day8/re-frame-http-fx/blob/master/src/day8/re_frame/http_fx.cljs does not seem to show :multipart-params anywhere
Hi all, wondering if anyone can explain what :meta
portion of this does exactly? I have a situation when I remove that portion I get errors in clojurescript.
(atom {} :meta {:listeners (atom {})})
The :meta
sets the metadata on the atom to whatever comes after :meta
, if that's what you're asking.
@U024X3V2YN4 sorry for not including. This is really a datascript thing. When I listen!
I get the error if not included:
(defn listen!
"Listen for changes on the given connection. Whenever a transaction is applied to the database via [[transact!]], the callback is called
with the transaction report. `key` is any opaque unique value.
Idempotent. Calling [[listen!]] with the same key twice will override old callback with the new value.
Returns the key under which this listener is registered. See also [[unlisten!]]."
([conn callback] (listen! conn (rand) callback))
([conn key callback]
{:pre [(conn? conn) (atom? (:listeners (meta conn)))]}
(swap! (:listeners (meta conn)) assoc key callback)
key))
(swap! (:listeners (meta conn)) assoc key callback)
here it is expecting that the metadata on the connection points to an atom. Thus there is a preconditien check in :pre
that checks specifically for this.@U024X3V2YN4 Yes exactly. Thank you for the explanation. I thought maybe there was an idiom here outside of datascript.