Fork me on GitHub
#luminus
<
2021-05-14
>
Mark McWiggins20:05:05

Anybody got a complete example with Luminus on cookie handling? This is the last step to be able to publish my first Clojure app and I am missing something. Thanks.

tobias00:05:10

I don't have an example but if you have a specific question then I might be able to help

Mark McWiggins22:05:19

Yes, ... background of what I'm doing:

Mark McWiggins22:05:15

I just want to have the user pick a level and represent that in the code ... I have the actions set up correctly, but getting the information in is my question:

Mark McWiggins22:05:30

(1) Better to use a cookie or an atom?

Mark McWiggins22:05:47

(2) If a cookie: what's the syntax in Luminus for:

Mark McWiggins22:05:56

(a) setting a cookie

Mark McWiggins22:05:16

(b) getting a cookie value back to use in the code

Mark McWiggins22:05:26

Thanks much for any suggestions!

tobias13:05:53

Hey @U01H6546F4Y, I've added a couple of routes and handlers to demonstrate setting and retrieving a cookie: https://github.com/jtlocsei/hello-world-web-app/commit/d7afdb420d2765ca97d6befe831bf454ca581c5b

tobias13:05:00

You probably already know this but you can inspect cookies in Chrome to see what's going on while you're debugging: https://developer.chrome.com/docs/devtools/storage/cookies/

tobias13:05:34

Live demo: https://guessing-game.mircloud.us/math/choose-level A cookie is used to store chosen difficulty level, and the question you get on the next page depends on the difficulty level you chose.