Show spinner when repos are loading
This commit is contained in:
parent
da7107ce87
commit
fb136e656d
|
@ -4,6 +4,7 @@
|
|||
{:page :issues
|
||||
:user nil
|
||||
:user-profile nil
|
||||
:repos-loading? false
|
||||
:repos []
|
||||
:enabled-repos {}
|
||||
:all-bounties []
|
||||
|
|
|
@ -111,12 +111,14 @@
|
|||
(reg-event-db
|
||||
:set-user-repos
|
||||
(fn [db [_ repos]]
|
||||
(assoc db :repos repos)))
|
||||
(-> db
|
||||
(assoc :repos repos)
|
||||
(assoc :repos-loading? false))))
|
||||
|
||||
(reg-event-fx
|
||||
:load-user-repos
|
||||
(fn [{:keys [db]} [_]]
|
||||
{:db db
|
||||
{:db (assoc db :repos-loading? true)
|
||||
:http {:method GET
|
||||
:url "/api/user/repositories"
|
||||
:on-success #(dispatch [:set-user-repos (:repositories %)])}}))
|
||||
|
|
|
@ -22,10 +22,13 @@
|
|||
[:p.text-gray.mt-1 description]]]]))
|
||||
|
||||
(defn repos-list []
|
||||
(let [repos (rf/subscribe [:repos])]
|
||||
(let [repos-loading? (rf/subscribe [:repos-loading?])
|
||||
repos (rf/subscribe [:repos])]
|
||||
(fn []
|
||||
[:div
|
||||
(map repository-row @repos)])))
|
||||
(if @repos-loading?
|
||||
[:i.fa.fa-spinner.fa-spin]
|
||||
(map repository-row @repos))])))
|
||||
|
||||
(defn enable-disable-button
|
||||
[button-id disable]
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
(fn [db _]
|
||||
(:user db)))
|
||||
|
||||
(reg-sub
|
||||
:repos-loading?
|
||||
(fn [db _]
|
||||
(:repos-loading? db)))
|
||||
|
||||
(reg-sub
|
||||
:repos
|
||||
(fn [db _]
|
||||
|
|
Loading…
Reference in New Issue