diff --git a/src/api/statistic.ts b/src/api/statistic.ts index b085b64b..62e1dce3 100644 --- a/src/api/statistic.ts +++ b/src/api/statistic.ts @@ -21,6 +21,7 @@ export type QuestionsResponse = { Results: Record; Questions: Record>; }; +export type GraphicsResponse = unknown; type TRequest = { to: number; @@ -91,3 +92,24 @@ export const getQuestions = async ( return [null, `Не удалось получить статистику по результатам. ${error}`]; } }; + +export const getGraphics = async ( + quizId: string, + to: number, + from: number, +): Promise<[GraphicsResponse | null, string?]> => { + try { + const questionsResponse = await makeRequest({ + method: "get", + url: `${API_URL}/${quizId}/pipelines?from=${from}&to=${to}`, + withCredentials: true, + }); + + console.log(questionsResponse) + return [questionsResponse]; + } catch (nativeError) { + const [error] = parseAxiosError(nativeError); + + return [null, `Не удалось получить статистику по результатам. ${error}`]; + } +}; \ No newline at end of file diff --git a/src/pages/IntegrationsPage/IntegrationsModal/AmoCRMModal.tsx b/src/pages/IntegrationsPage/IntegrationsModal/AmoCRMModal.tsx index 4b120218..63fe9e81 100644 --- a/src/pages/IntegrationsPage/IntegrationsModal/AmoCRMModal.tsx +++ b/src/pages/IntegrationsPage/IntegrationsModal/AmoCRMModal.tsx @@ -172,10 +172,7 @@ export const AmoCRMModal: FC = ({ isModalOpen, handleClo Customer: [{ QuestionID: {} }], }; - console.log("selectedQuestions"); - console.log(selectedQuestions); for (let key in FieldsRule) { - console.log("current key ", key); selectedQuestions[key as QuestionKeys].forEach((id) => { FieldsRule[key as QuestionKeys][0].QuestionID[id] = 0; }); @@ -185,9 +182,6 @@ export const AmoCRMModal: FC = ({ isModalOpen, handleClo } body.FieldsRule = FieldsRule; - console.log("На отправку"); - console.log(body); - if (firstRules) { setIntegrationRules(quizID.toString(), body); } else { diff --git a/src/pages/Questions/QuestionsPage.tsx b/src/pages/Questions/QuestionsPage.tsx index 53d3e2f7..fc0c2c81 100755 --- a/src/pages/Questions/QuestionsPage.tsx +++ b/src/pages/Questions/QuestionsPage.tsx @@ -45,6 +45,7 @@ export default function QuestionsPage({ }, []); if (!quiz) return null; + return ( <> diff --git a/src/utils/hooks/useAnalytics.ts b/src/utils/hooks/useAnalytics.ts index d2801f2d..7cb80665 100644 --- a/src/utils/hooks/useAnalytics.ts +++ b/src/utils/hooks/useAnalytics.ts @@ -4,6 +4,7 @@ import { GeneralResponse, getDevices, getGeneral, + getGraphics, getQuestions, QuestionsResponse, } from "@api/statistic"; @@ -35,11 +36,9 @@ export function useAnalytics({ ready, quizId, to, from }: useAnalyticsProps) { const [gottenGeneral] = await getGeneral(quizId, formatTo, formatFrom); const [gottenDevices] = await getDevices(quizId, formatTo, formatFrom); - const [gottenQuestions] = await getQuestions( - quizId, - formatTo, - formatFrom, - ); + const [gottenQuestions] = await getQuestions(quizId, formatTo, formatFrom); + + getGraphics(quizId, formatTo, formatFrom) if (gottenGeneral) { setGeneral(gottenGeneral);