loading of console's commands.js without running server

This commit is contained in:
Roman Volosovskyi 2016-06-27 10:24:27 +03:00
parent 923b2af648
commit a3de75127a
1 changed files with 6 additions and 3 deletions

View File

@ -1,4 +1,5 @@
(ns status-im.commands.handlers.loading (ns status-im.commands.handlers.loading
(:require-macros [status-im.utils.slurp :refer [slurp]])
(:require [re-frame.core :refer [register-handler after dispatch subscribe (:require [re-frame.core :refer [register-handler after dispatch subscribe
trim-v debug]] trim-v debug]]
[status-im.utils.handlers :as u] [status-im.utils.handlers :as u]
@ -23,9 +24,11 @@
(defn fetch-commands! (defn fetch-commands!
[db [identity]] [db [identity]]
(when-let [url (:dapp-url (get-in db [:chats identity]))] (when-let [url (:dapp-url (get-in db [:chats identity]))]
(http-get (s/join "/" [url commands-js]) (if (= "console" identity)
#(dispatch [::validate-hash identity %]) (dispatch [::validate-hash identity (slurp "resources/commands.js")])
#(dispatch [::loading-failed! identity ::file-was-not-found])))) (http-get (s/join "/" [url commands-js])
#(dispatch [::validate-hash identity %])
#(dispatch [::loading-failed! identity ::file-was-not-found])))))
(defn dispatch-loaded! (defn dispatch-loaded!
[db [identity file]] [db [identity file]]