Remove unecessary user id generation code
This commit is contained in:
parent
4c938b5300
commit
293a663763
@ -79,30 +79,11 @@
|
|||||||
(.sendMessage (.-id tab)
|
(.sendMessage (.-id tab)
|
||||||
(clj->js {:type "openSidebar"}))))
|
(clj->js {:type "openSidebar"}))))
|
||||||
|
|
||||||
(defn get-user-id []
|
|
||||||
(go
|
|
||||||
(let [user-id (-> js/browser
|
|
||||||
(.-storage)
|
|
||||||
(.-local)
|
|
||||||
(.get "userId")
|
|
||||||
(promise->channel)
|
|
||||||
(<!)
|
|
||||||
(.-userId))]
|
|
||||||
(if (nil? user-id)
|
|
||||||
(let [uuid (.-uuid (random-uuid))]
|
|
||||||
(-> js/browser
|
|
||||||
(.-storage)
|
|
||||||
(.-local)
|
|
||||||
(.set (clj->js {"userId" uuid})))
|
|
||||||
uuid)
|
|
||||||
user-id))))
|
|
||||||
|
|
||||||
(defn handle-message [msg sender respond]
|
(defn handle-message [msg sender respond]
|
||||||
(case (.-type msg)
|
(case (.-type msg)
|
||||||
"hits" (channel->promise (go @hits))
|
"hits" (channel->promise (go @hits))
|
||||||
"fetchItem" (channel->promise
|
"fetchItem" (channel->promise
|
||||||
(go (clj->js (<! (hn/fetch-item (.-id msg))))))
|
(go (clj->js (<! (hn/fetch-item (.-id msg))))))))
|
||||||
"getUserId" (channel->promise (get-user-id))))
|
|
||||||
|
|
||||||
(-> js/browser
|
(-> js/browser
|
||||||
(.-tabs)
|
(.-tabs)
|
||||||
|
Loading…
Reference in New Issue
Block a user