mirror of https://github.com/logseq/logseq
refactor: simplify p/let
parent
47b30bc3e5
commit
14e11c6740
|
@ -463,21 +463,21 @@
|
||||||
[]
|
[]
|
||||||
(if js/window.pfs
|
(if js/window.pfs
|
||||||
(let [repo config/local-repo]
|
(let [repo config/local-repo]
|
||||||
(p/let [result (-> (fs/mkdir (str "/" repo))
|
(p/do! (-> (fs/mkdir (str "/" repo))
|
||||||
(p/catch (fn [_e] nil)))
|
(p/catch (fn [_e] nil)))
|
||||||
_ (state/set-current-repo! repo)
|
(state/set-current-repo! repo)
|
||||||
_ (db/start-db-conn! nil repo)
|
(db/start-db-conn! nil repo)
|
||||||
_ (when-not config/publishing?
|
(when-not config/publishing?
|
||||||
(let [dummy-notes (get-in dicts/dicts [:en :tutorial/dummy-notes])]
|
(let [dummy-notes (get-in dicts/dicts [:en :tutorial/dummy-notes])]
|
||||||
(create-dummy-notes-page repo dummy-notes)))
|
(create-dummy-notes-page repo dummy-notes)))
|
||||||
_ (when-not config/publishing?
|
(when-not config/publishing?
|
||||||
(let [tutorial (get-in dicts/dicts [:en :tutorial/text])
|
(let [tutorial (get-in dicts/dicts [:en :tutorial/text])
|
||||||
tutorial (string/replace-first tutorial "$today" (date/today))]
|
tutorial (string/replace-first tutorial "$today" (date/today))]
|
||||||
(create-today-journal-if-not-exists repo tutorial)))
|
(create-today-journal-if-not-exists repo tutorial)))
|
||||||
_ (create-config-file-if-not-exists repo)
|
(create-config-file-if-not-exists repo)
|
||||||
_ (create-contents-file repo)
|
(create-contents-file repo)
|
||||||
_ (create-custom-theme repo)]
|
(create-custom-theme repo)
|
||||||
(state/set-db-restoring! false)))
|
(state/set-db-restoring! false)))
|
||||||
(js/setTimeout setup-local-repo-if-not-exists! 100)))
|
(js/setTimeout setup-local-repo-if-not-exists! 100)))
|
||||||
|
|
||||||
(defn periodically-pull
|
(defn periodically-pull
|
||||||
|
@ -555,10 +555,10 @@
|
||||||
(spec/validate :repos/repo repo)
|
(spec/validate :repos/repo repo)
|
||||||
(db/remove-conn! url)
|
(db/remove-conn! url)
|
||||||
(db/clear-query-state!)
|
(db/clear-query-state!)
|
||||||
(-> (p/let [_ (db/remove-db! url)
|
(-> (p/do! (db/remove-db! url)
|
||||||
_ (db/remove-files-db! url)
|
(db/remove-files-db! url)
|
||||||
_ (fs/rmdir (util/get-repo-dir url))]
|
(fs/rmdir (util/get-repo-dir url))
|
||||||
(clone-and-pull url))
|
(clone-and-pull url))
|
||||||
(p/catch (fn [error]
|
(p/catch (fn [error]
|
||||||
(prn "Delete repo failed, error: " error)))))
|
(prn "Delete repo failed, error: " error)))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue