Fork me on GitHub
#reagent
<
2019-12-24
>
lackita19:12:08

Hey, looking for some advice on handling a changing anti-forgery token between ajax requests. Right now, I'm initially loading the value into an atom, and then reset!ing that value based on a response header I'm populating. It's not working horribly well, though, the token still ends up getting rejected at some point, and I can't figure out why.

p-himik19:12:59

If that happens only after you hot reload your code during development, it might be that you're using def instead of defonce. Apart from that, no idea.

lackita19:12:41

let me see if that helps

lackita03:12:41

I didn't exactly figure it out, but I found a way to make everything simpler, which made the problem go away. I was updating the session in an ajax request, which I think was causing the token to change. When I changed things around so all that information was in the session when the SPA initially loads, everything worked a lot smoother.

👍 1