[front/perf] load more show question title
This commit is contained in:
parent
5d2191dad3
commit
4c05a47117
1 changed files with 15 additions and 1 deletions
|
@ -97,6 +97,18 @@
|
|||
(remove select-item db)
|
||||
(merge (first (filter select-item db)) history-item)))})))
|
||||
|
||||
(reg-event-fx
|
||||
:get-question-by-history
|
||||
(fn [{:keys [db]} [_ {:keys [id type]}]]
|
||||
(let [history (get db :history)
|
||||
select-history (fn [x]
|
||||
(and (= (:id x) id)
|
||||
(= (:type x) type)))
|
||||
question-history (first (filter select-history history))]
|
||||
{:db (-> db
|
||||
(assoc-in [:post :question :title] (:title question-history))
|
||||
(assoc-in [:post :question :detail] (:detail question-history)))})))
|
||||
|
||||
(reg-event-fx
|
||||
:get-question-success
|
||||
(fn [{:keys [db]} [_ {body :body}]]
|
||||
|
@ -113,7 +125,9 @@
|
|||
{:db (-> db
|
||||
(assoc-in [:loading :question] false)
|
||||
(assoc-in [:post] body))
|
||||
:dispatch [:set-history params]})))
|
||||
:dispatch-n [(when (nil? question)
|
||||
[:get-question-by-history params])
|
||||
[:set-history params]]})))
|
||||
|
||||
(reg-event-db
|
||||
:get-question-failure
|
||||
|
|
Loading…
Reference in a new issue