diff --git a/package.json b/package.json index 0cb1d577..d8aeef1f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "drama-queen-container", "private": true, - "version": "1.3.9", + "version": "1.3.10", "workspaces": [ "drama-queen", "queen-v2", diff --git a/queen-v2/package.json b/queen-v2/package.json index 532b7d6c..d14c637f 100644 --- a/queen-v2/package.json +++ b/queen-v2/package.json @@ -1,6 +1,6 @@ { "name": "queen-v2", - "version": "1.0.11", + "version": "1.0.12", "description": "Web application for the management of questionnaires powered by Lunatic", "repository": { "type": "git", diff --git a/queen-v2/src/components/orchestratorManager/orchestratorManager.js b/queen-v2/src/components/orchestratorManager/orchestratorManager.js index bee66992..541218c5 100644 --- a/queen-v2/src/components/orchestratorManager/orchestratorManager.js +++ b/queen-v2/src/components/orchestratorManager/orchestratorManager.js @@ -31,8 +31,7 @@ export const OrchestratorManager = () => { [idQ, idSU, readonly] ); - const { surveyUnit, questionnaire, nomenclatures, loadingMessage, errorMessage } = - useAPIRemoteData(idSU, idQ); + const { surveyUnit, questionnaire, loadingMessage, errorMessage } = useAPIRemoteData(idSU, idQ); const stateData = surveyUnit?.stateData; const initialData = surveyUnit?.data; @@ -73,7 +72,7 @@ export const OrchestratorManager = () => { setError(questionnaireError); } } - }, [questionnaire, surveyUnit, nomenclatures, apiUrl, LOGGER, init]); + }, [questionnaire, surveyUnit, apiUrl, LOGGER, init]); useEffect(() => { if (errorMessage) setError(errorMessage); diff --git a/queen-v2/src/utils/hook/api.js b/queen-v2/src/utils/hook/api.js index 0684f774..1f915870 100644 --- a/queen-v2/src/utils/hook/api.js +++ b/queen-v2/src/utils/hook/api.js @@ -39,7 +39,7 @@ export const useGetReferentiel = nomenclatures => { const getReferentiel = useCallback( refName => { const finalUrl = `${apiUrl}/api/nomenclature/${refName}`; - return getFetcherForLunatic(oidcUser?.accessToken)(finalUrl); + return getFetcherForLunatic(oidcUser?.access_token)(finalUrl); }, [apiUrl, oidcUser] ); @@ -48,7 +48,7 @@ export const useGetReferentiel = nomenclatures => { refName => { if (nomenclatures && Object.keys(nomenclatures).includes(refName)) { const finalUrl = nomenclatures[refName]; - return getFetcherForLunatic(oidcUser?.accessToken)(finalUrl); + return getFetcherForLunatic(oidcUser?.access_token)(finalUrl); } // No nomenclature, return empty array to lunatic return Promise.resolve([]); @@ -169,20 +169,18 @@ export const useGetSurveyUnit = () => { export const useAPIRemoteData = (surveyUnitID, questionnaireID) => { const { standalone } = useContext(AppContext); const [questionnaire, setQuestionnaire] = useState(null); - const [nomenclatures, setNomenclatures] = useState(null); const [surveyUnit, setSurveyUnit] = useState(null); const [loadingMessage, setLoadingMessage] = useState(''); const [errorMessage, setErrorMessage] = useState(null); - const { getQuestionnaire, getRequiredNomenclatures } = useAPI(); + const { getQuestionnaire } = useAPI(); const getSurveyUnit = useGetSurveyUnit(); useEffect(() => { if (questionnaireID && surveyUnitID && !questionnaire && !surveyUnit) { setErrorMessage(null); setQuestionnaire(null); - setNomenclatures(null); setSurveyUnit(null); const load = async () => { setLoadingMessage(Dictionary.waitingCleaning); @@ -190,10 +188,8 @@ export const useAPIRemoteData = (surveyUnitID, questionnaireID) => { if (!error) { setLoadingMessage(Dictionary.waitingQuestionnaire); const qR = await getQuestionnaire(questionnaireID); - const nR = await getRequiredNomenclatures(questionnaireID); - if (!qR.error && !nR.error && qR.status !== 404) { + if (!qR.error && qR.status !== 404) { setQuestionnaire(qR.data.value); - setNomenclatures(nR.data); setLoadingMessage(Dictionary.waitingDataSU); const suR = await getSurveyUnit(surveyUnitID, standalone); if (!suR.error && suR.surveyUnit) { @@ -212,7 +208,7 @@ export const useAPIRemoteData = (surveyUnitID, questionnaireID) => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [surveyUnitID, questionnaireID]); - return { loadingMessage, errorMessage, surveyUnit, questionnaire, nomenclatures }; + return { loadingMessage, errorMessage, surveyUnit, questionnaire }; }; export const useRemoteData = (questionnaireUrl, dataUrl) => {