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