Fork me on GitHub
#re-frame
<
2019-01-16
>
Jenny Kwan00:01:27

Hey everyone. Sorry for the n00b question. I'm not front-end at all and have invested literally no time into understanding the re-frame loop. I just have a Chestnut templated application with re-frame that I'm trying to add a file upload form into. I'm sure I'm doing it wrong since I'm not dispatching any events - the form action is a direct POST - but in any case, my immediate issue is that I have no idea how to acquire and inject a CSRF token control into the form. I haven't had luck finding examples online, and definitely none with a walkthrough as to exactly what needs touching. Halp!

lilactown00:01:27

chestnut should have a way of putting the CSRF token on the page

Jenny Kwan00:01:16

OK. I can find nothing but I'll reach out on Clojureverse.

lilactown00:01:36

so you'll want to put that on the page. you'll probably want to parse it so that you can put the token in a global JS var

lilactown00:01:01

then, your app can read the CSRF token from the global var and put it in the form

drewverlee01:01:21

So there is no order in a effects map. But then why would i obverse the same event order most (95%) of the time? shouldn't it be a even distribution? maybe my experiment if flawed?

lilactown05:01:44

> no order in an effects map what do you mean by this? the order in which the effects occur?

mikethompson05:01:08

@drewverlee the order in which effects are processed is not guaranteed so you should not rely on it. Even if you see a pattern.

Jenny Kwan05:01:44

@lilactown The issue seems to be the inability of client-side cljs accessing the ring.middleware.anti-forgery vars.

Jenny Kwan05:01:56

Going to ask in #reagent. Thanks!