This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-16
Channels
- # announcements (2)
- # beginners (50)
- # boot (80)
- # calva (4)
- # cider (58)
- # cljs-dev (11)
- # clojure (140)
- # clojure-brasil (1)
- # clojure-denver (1)
- # clojure-dev (10)
- # clojure-europe (8)
- # clojure-finland (2)
- # clojure-italy (5)
- # clojure-nl (2)
- # clojure-quebec (1)
- # clojure-spec (2)
- # clojure-sweden (4)
- # clojure-uk (94)
- # clojurescript (98)
- # cursive (19)
- # data-science (1)
- # datascript (9)
- # datomic (43)
- # emacs (2)
- # fulcro (29)
- # graphql (41)
- # hoplon (15)
- # jobs (2)
- # kaocha (4)
- # liberator (24)
- # off-topic (9)
- # perun (1)
- # re-frame (11)
- # reagent (17)
- # reitit (8)
- # remote-jobs (2)
- # rum (2)
- # shadow-cljs (24)
- # spacemacs (1)
- # specter (1)
- # tools-deps (21)
The decision graph can be helpful here http://clojure-liberator.github.io/liberator/tutorial/decision-graph.html
Thank you. I know but it is not so obviously as it looks when I donât know deeply liberator đ
Thatâs true. Still itâs the quickes way to âbacktraceâ from the desired outcome handler and look at the decisions on the way đ
{:allowed-methods [:post]
:new? false
:handle-no-content (fn [{:keys [request] :as ctx}]
(let [{:keys [params]} request
{:keys [email password]} params]
(if-let [uuid (auth/?login->uuid email password)]
(ring-response {
:session {:uuid uuid}})
(ring-response {:status 401
:session nil}))))}
@ordnungswidrig so you are saying it is less weird now đ
So somebody try to login and get HTTP 204 đ
Unless I return :status 200
which is not less weird.How do you analyse decision graph? It is too small in Safari and I canât use cmd+f. Any trick for that to make life easier in simple way?
hmmm, there was an issue with the svg viewpoint in the graph which I donât remember. You can save a copy and remove the size declaration at the very top.
On the other hand you should not explicitly set the status from a handler here but make use if :authorized?
to handle the login case.
it is ok when I check if somebody is autorized, but when somebody login I feel confuse about that
you can assoc the session to the context and later return:
:authorized (fn [ctx] (if ... {:session {:uuid uuid}})
This will set the key session
in the ctx:
:handle-no-content (fn [ctx] (ring-response :session (:session ctx))
I think you can make use of :as-response
to retrieve the session for all handler.
hmm in the there is :authorized?
, there is not :authorized
http://clojure-liberator.github.io/liberator/doc/decisions.html
Regarding the decision graph the debugging wrapper might be helpful too :http://clojure-liberator.github.io/liberator/tutorial/debugging.html btw.
Need to leave now, I will have a look at the chat later today.
I donât have code at hand but I can craft an example for session handling later.