Only request user repos when admin token available
This commit is contained in:
parent
d6aaa2dcea
commit
2a05a6bef7
|
@ -213,14 +213,15 @@
|
||||||
(reg-event-fx
|
(reg-event-fx
|
||||||
:load-user-repos
|
:load-user-repos
|
||||||
(fn [{:keys [db]} [_]]
|
(fn [{:keys [db]} [_]]
|
||||||
{:db (assoc db :repos-loading? true)
|
(conj {:db (assoc db :repos-loading? true)}
|
||||||
|
(when-let [token (get-admin-token db)]
|
||||||
:http {:method GET
|
:http {:method GET
|
||||||
:url "/api/user/repositories"
|
:url "/api/user/repositories"
|
||||||
:params {:token (get-admin-token db)}
|
:params {:token token}
|
||||||
:on-success #(dispatch [:set-user-repos (:repositories %)])
|
:on-success #(dispatch [:set-user-repos (:repositories %)])
|
||||||
:on-error #(dispatch [:set-flash-message
|
:on-error #(dispatch [:set-flash-message
|
||||||
:error "Failed to load repositories"])
|
:error "Failed to load repositories"])
|
||||||
:finally #(dispatch [:clear-repos-loading])}}))
|
:finally #(dispatch [:clear-repos-loading])}))))
|
||||||
|
|
||||||
|
|
||||||
(defn update-repo-state [all-repos full-name data]
|
(defn update-repo-state [all-repos full-name data]
|
||||||
|
|
Loading…
Reference in New Issue