Fork me on GitHub
#liberator
<
2019-01-15
>
kwladyka15:01:38

Can I run handle-ok instead of handle-created for POST? Especially about auth operations like login / logout.

kwladyka16:01:46

:handle-created (fn [{:keys [request] :as ctx}]
                                                (let [{:keys [params]} request
                                                      {:keys [email password]} params]
                                                  (println "request" request)
                                                  (if-let [uuid (login email password)]
                                                    (ring-response {:status 200
                                                                    :session {:uuid uuid}})
                                                    (ring-response {:status 401
                                                                    :session nil}))))
Now I have this, but I feel a little weird with :handle-created