Don't prompts Github app installation if not 401 error

pull/645/head
Tienson Qin 2020-09-02 07:30:10 +08:00
parent 368e6b3a2d
commit 331bd076cc
1 changed files with 10 additions and 2 deletions

View File

@ -365,14 +365,22 @@
:error)
(route-handler/redirect! {:to :diff}))))))
(p/catch (fn [error]
(println "Pull error:")
(js/console.error error)
;; token might be expired, request new token
(if (and (string/includes? (str error) "401")
(cond
(and (string/includes? (str error) "401")
(not fallback?))
(request-app-tokens!
(fn []
(pull repo-url (state/get-github-token repo-url) true))
nil)
(show-install-error! repo-url (util/format "Failed to fetch %s." repo-url) false)))))))))))
(string/includes? (str error) "401")
(show-install-error! repo-url (util/format "Failed to fetch %s." repo-url) false)
:else
nil))))))))))
(defn check-changed-files-status
[f]