diff --git a/src/clj/commiteth/routes/services.clj b/src/clj/commiteth/routes/services.clj index d9e01e9..b38f588 100644 --- a/src/clj/commiteth/routes/services.clj +++ b/src/clj/commiteth/routes/services.clj @@ -158,7 +158,8 @@ (ok (activity-feed))) (GET "/open-bounties" [] (log/debug "/open-bounties") - (ok (bounties-db/open-bounties))) + (ok (map #(update % :balance decimal->str) + (bounties-db/open-bounties)))) (context "/user" [] (GET "/" [] :auth-rules authenticated? diff --git a/src/cljs/commiteth/db.cljs b/src/cljs/commiteth/db.cljs index efc1824..356f826 100644 --- a/src/cljs/commiteth/db.cljs +++ b/src/cljs/commiteth/db.cljs @@ -5,19 +5,7 @@ :user nil :repos-loading? false :repos {} - :open-bounties [{:confirm_hash nil, - :issue_id 207799767, - :issue_number 19, - :repo_name "commiteth", - :updated #inst "2017-03-16T18:32:43.113-00:00", - :issue_title "Estimate gas instead of hard-coding", - :repo_owner "status-im", - :repo_owner_avatar_url "https://avatars2.githubusercontent.com/u/11767950?v=3" - :balance 0.0M, - :payout_receipt nil, - :repo_id 65593470, - :contract_address "0xaf77604e06169b210158f00ad4d3ef028aecded9", - :payout_hash nil}] + :open-bounties [] :owner-bounties {} :top-hunters [] :activity-feed []}) diff --git a/src/cljs/commiteth/handlers.cljs b/src/cljs/commiteth/handlers.cljs index 4cb1a92..f599db8 100644 --- a/src/cljs/commiteth/handlers.cljs +++ b/src/cljs/commiteth/handlers.cljs @@ -96,6 +96,19 @@ (fn [db [_ activity-feed]] (assoc db :activity-feed activity-feed))) +(reg-event-fx + :load-open-bounties + (fn [{:keys [db]} [_]] + {:db db + :http {:method GET + :url "/api/open-bounties" + :on-success #(dispatch [:set-open-bounties %])}})) + +(reg-event-db + :set-open-bounties + (fn [db [_ issues]] + (assoc db :open-bounties issues))) + (reg-event-fx :load-owner-bounties @@ -125,7 +138,8 @@ {:db (assoc db :user (:user user-profile)) :dispatch-n [[:load-user-repos] - [:load-owner-bounties]]})) + [:load-owner-bounties] + [:load-open-bounties]]})) (reg-event-db :clear-repos-loading