This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-10
Channels
- # announcements (4)
- # beginners (111)
- # boot (34)
- # cider (67)
- # cljdoc (10)
- # clojure (90)
- # clojure-dev (37)
- # clojure-europe (3)
- # clojure-gamedev (3)
- # clojure-italy (18)
- # clojure-losangeles (2)
- # clojure-nl (27)
- # clojure-spec (24)
- # clojure-uk (59)
- # clojurescript (41)
- # cursive (32)
- # datomic (31)
- # emacs (21)
- # figwheel (1)
- # figwheel-main (2)
- # fulcro (43)
- # graalvm (6)
- # graphql (3)
- # jobs-discuss (3)
- # kaocha (1)
- # nyc (1)
- # off-topic (22)
- # pathom (10)
- # pedestal (11)
- # re-frame (9)
- # reitit (17)
- # shadow-cljs (15)
- # spacemacs (13)
- # sql (6)
- # testing (5)
- # tools-deps (3)
- # vim (13)
- # yada (1)
so a few days back I posted a question, asking how to create 'protected routes', that will not be accessible for users, if they're not logged in. In my case, I'm using JWT token, that I store in local storage + re-frame db. I also wanted it to be a sort of clean solution - not hacky basically. I couldn't find any solutions on web and after fiddling around for quite some time, I got it working by creating an interceptor for it. I was thinking about writing up a little blog post on this. but first I thought I'd check on here, how useful do people think it would be?
someone posted this in the channel yesterday https://clojurians.slack.com/archives/C073DKH9P/p1557416430333700
it sounds like there’s an inject-sub
interceptor that allows you to do what you want tho
I see that. Would passing the result of the subscription to the event not work just as well?
@petr My (somewhat shallow) understanding is that there’s a risk of memory leaks if you grab a subscription value directly inside an event handler, and the inject-sub
mechanism avoids that. If you’re just grabbing a value inside the app-db, though, it’s a lot simpler to grab it directly. You can use prefix functions if you’re concerned about changing paths inside the app-db at some point in the future.