fix #866
This commit is contained in:
parent
874bf16f97
commit
bc9ec05de3
|
@ -37,6 +37,11 @@
|
|||
|
||||
(and dapp? dapp-url)
|
||||
(http-get (s/join "/" [dapp-url commands-js])
|
||||
(fn [response]
|
||||
(and
|
||||
(string? (.text response))
|
||||
(when-let [content-type (.. response -headers (get "Content-Type"))]
|
||||
(s/includes? "application/javascript" content-type))))
|
||||
#(dispatch [::validate-hash whisper-identity %])
|
||||
#(dispatch [::validate-hash whisper-identity js-res/dapp-js]))
|
||||
|
||||
|
|
|
@ -41,10 +41,16 @@
|
|||
|
||||
(defn http-get
|
||||
([url on-success on-error]
|
||||
(http-get url nil on-success on-error))
|
||||
([url valid-response? on-success on-error]
|
||||
(-> (.fetch js/window url (clj->js {:method "GET"}))
|
||||
(.then (fn [response]
|
||||
(log response)
|
||||
[(.text response) (.-ok response)]))
|
||||
(let [ok? (.-ok response)
|
||||
ok?' (if valid-response?
|
||||
(and ok? (valid-response? response))
|
||||
ok?)]
|
||||
[(.text response) ok?'])))
|
||||
(.then (fn [[response ok?]]
|
||||
(cond
|
||||
ok? (on-success response)
|
||||
|
|
Loading…
Reference in New Issue