Add migration

pull/645/head 0.0.2.2
Tienson Qin 2020-08-29 23:01:28 +08:00
parent 4f5f17803b
commit 504b07005a
1 changed files with 12 additions and 5 deletions

View File

@ -126,15 +126,22 @@
(defn request-app-tokens!
[ok-handler error-handler]
(let [installation-ids (->> (map :installation_id (:repos (state/get-me)))
(let [repos (:repos (state/get-me))
installation-ids (->> (map :installation_id repos)
(remove nil?)
(distinct))]
(when (seq installation-ids)
(when (or (seq repos)
(seq installation-ids))
(util/post (str config/api "refresh_github_token")
{:installation-ids installation-ids}
{:installation-ids installation-ids
:repos repos}
(fn [result]
(if (= "refresh" (:message result))
;; reload
(set! (.-href js/window.location) config/website)
(do
(state/set-github-installation-tokens! result)
(when ok-handler (ok-handler)))
(when ok-handler (ok-handler)))))
(fn [error]
(println "Something wrong!")
(js/console.dir error)