[back/refactor] remove duplicate request
This commit is contained in:
parent
6f5c2987b3
commit
0b582e2fb0
1 changed files with 8 additions and 3 deletions
|
@ -174,6 +174,13 @@
|
||||||
"question_id" question-id}
|
"question_id" question-id}
|
||||||
(build-paging-next next_url))}))))
|
(build-paging-next next_url))}))))
|
||||||
|
|
||||||
|
(defn build-answer-json
|
||||||
|
[question-id query]
|
||||||
|
(let [answers (fetch-hu-answers question-id query)]
|
||||||
|
(merge
|
||||||
|
{:answers (mapv build-answer (get answers "data"))}
|
||||||
|
(process-api-paging question-id (get answers "paging")))))
|
||||||
|
|
||||||
(defn fetch-hu-question
|
(defn fetch-hu-question
|
||||||
[request params]
|
[request params]
|
||||||
(let [question-id (-> request :path-params :id)
|
(let [question-id (-> request :path-params :id)
|
||||||
|
@ -199,9 +206,7 @@
|
||||||
(process-json-paging question-id (get-in question-json ["initialState" "question"])))
|
(process-json-paging question-id (get-in question-json ["initialState" "question"])))
|
||||||
params)
|
params)
|
||||||
(process-hu-questiion
|
(process-hu-questiion
|
||||||
(merge
|
(build-answer-json question-id query)
|
||||||
{:answers (mapv build-answer (get (fetch-hu-answers question-id query) "data"))}
|
|
||||||
(process-api-paging question-id (get (fetch-hu-answers question-id query) "paging")))
|
|
||||||
params)))))
|
params)))))
|
||||||
|
|
||||||
(defn build-api-hu-question
|
(defn build-api-hu-question
|
||||||
|
|
Loading…
Reference in a new issue