From e2533e9964fdfd3903c1bc9331ea8f050a2efc2f Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Fri, 19 Oct 2018 10:33:27 +0200 Subject: [PATCH] http kudos token image Signed-off-by: Andrey Shovkoplyas --- .../wallet/collectibles/kudos/events.cljs | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/status_im/ui/screens/wallet/collectibles/kudos/events.cljs b/src/status_im/ui/screens/wallet/collectibles/kudos/events.cljs index cef84aa0f8..1be47ceb77 100644 --- a/src/status_im/ui/screens/wallet/collectibles/kudos/events.cljs +++ b/src/status_im/ui/screens/wallet/collectibles/kudos/events.cljs @@ -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) @@ -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)}])}}))