[back/refactor] remove duplicate request

This commit is contained in:
SouthFox 2023-09-30 23:33:07 +08:00
parent 6f5c2987b3
commit 0b582e2fb0

View file

@ -174,6 +174,13 @@
"question_id" question-id}
(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
[request params]
(let [question-id (-> request :path-params :id)
@ -199,9 +206,7 @@
(process-json-paging question-id (get-in question-json ["initialState" "question"])))
params)
(process-hu-questiion
(merge
{: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")))
(build-answer-json question-id query)
params)))))
(defn build-api-hu-question