http kudos token image

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2018-10-19 10:33:27 +02:00
parent 7d0c655441
commit e2533e9964
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
1 changed files with 15 additions and 8 deletions

View File

@ -6,7 +6,8 @@
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.utils.handlers :as handlers] [status-im.utils.handlers :as handlers]
[status-im.constants :as constants] [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) (def kudos :KDO)
@ -23,14 +24,20 @@
#(re-frame/dispatch [:token-uri-success #(re-frame/dispatch [:token-uri-success
tokenId tokenId
(when %2 (when %2
;;TODO extra chars in rinkeby (subs %2 (.indexOf %2 "http")))]))))) ;; extra chars in rinkeby
(subs %2 (.indexOf %2 "http")))])))))
(handlers/register-handler-fx (handlers/register-handler-fx
:token-uri-success :token-uri-success
(fn [_ [_ tokenId token-uri]] (fn [_ [_ tokenId token-uri]]
{:http-get {:url token-uri {:http-get {:url
:success-event-creator (fn [o] token-uri
[:load-collectible-success kudos {tokenId (http/parse-payload o)}]) :success-event-creator
:failure-event-creator (fn [o] (fn [o]
[:load-collectible-failure kudos {tokenId (http/parse-payload 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)}])}}))