Skip to content

Commit

Permalink
http kudos token image
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
  • Loading branch information
flexsurfer authored and jeluard committed Oct 19, 2018
1 parent abaf79d commit fe720cb
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/status_im/ui/screens/wallet/collectibles/kudos/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
[re-frame.core :as re-frame]
[status-im.utils.handlers :as handlers]
[status-im.constants :as constants]
[status-im.utils.ethereum.core :as ethereum]))
[status-im.utils.ethereum.core :as ethereum]
[clojure.string :as string]))

(def kudos :KDO)

Expand All @@ -23,14 +24,20 @@
#(re-frame/dispatch [:token-uri-success
tokenId
(when %2
;;TODO extra chars in rinkeby
(subs %2 (.indexOf %2 "http")))])))))
(subs %2 (.indexOf %2 "http")))]))))) ;; extra chars in rinkeby

(handlers/register-handler-fx
:token-uri-success
(fn [_ [_ tokenId token-uri]]
{:http-get {:url token-uri
:success-event-creator (fn [o]
[:load-collectible-success kudos {tokenId (http/parse-payload o)}])
:failure-event-creator (fn [o]
[:load-collectible-failure kudos {tokenId (http/parse-payload o)}])}}))
{:http-get {:url
token-uri
:success-event-creator
(fn [o]
[:load-collectible-success kudos {tokenId (update (http/parse-payload o)
:image
string/replace
#"http:"
"https:")}]) ;; http in mainnet
:failure-event-creator
(fn [o]
[:load-collectible-failure kudos {tokenId (http/parse-payload o)}])}}))

0 comments on commit fe720cb

Please sign in to comment.