From 7b310f48dcad6b7e4ee76a2d78260c9b445341a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20Dr=C3=A9au?= Date: Fri, 13 Oct 2023 16:18:53 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20r=C3=A9pare=20le=20lien=20vers=20l'arbo?= =?UTF-8?q?=20rome=20en=20local=20(#3286)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/common/httpClient.ts | 14 ++++++++++++++ .../FiltreFormationSecteurProfessionnel.tsx | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ui/common/httpClient.ts b/ui/common/httpClient.ts index ece77bbfc..a486d1404 100644 --- a/ui/common/httpClient.ts +++ b/ui/common/httpClient.ts @@ -73,6 +73,20 @@ const getHttpsAgent = () => { : undefined; }; +/** + * Récupère un fichier exposé par l'UI. + * Nécessaire pour l'environnement local, car les ports sont maintenant exposés. + */ +export const _getUI = async (path: string, options?: AxiosRequestConfig): Promise => { + const response = await axios.get(path, { + headers: getHeaders(), + validateStatus: () => true, + httpsAgent: getHttpsAgent(), + ...options, + }); + return handleResponse(path, response); +}; + export const _get = async (path: string, options?: AxiosRequestConfig): Promise => { const response = await axios.get(`${publicConfig.baseUrl}${path}`, { headers: getHeaders(), diff --git a/ui/modules/indicateurs/filters/FiltreFormationSecteurProfessionnel.tsx b/ui/modules/indicateurs/filters/FiltreFormationSecteurProfessionnel.tsx index fcd4233bb..bd99d4b68 100644 --- a/ui/modules/indicateurs/filters/FiltreFormationSecteurProfessionnel.tsx +++ b/ui/modules/indicateurs/filters/FiltreFormationSecteurProfessionnel.tsx @@ -16,7 +16,7 @@ import { useQuery } from "@tanstack/react-query"; import { useMemo, useState } from "react"; import TreeView, { flattenTree } from "react-accessible-treeview"; -import { _get, _post } from "@/common/httpClient"; +import { _get, _getUI, _post } from "@/common/httpClient"; import { normalize } from "@/common/utils/stringUtils"; import InputLegend from "@/components/InputLegend/InputLegend"; import { ArrowTriangleDownIcon } from "@/modules/dashboard/icons"; @@ -45,7 +45,7 @@ const FiltreFormationSecteurProfessionnel = (props: FiltreFormationSecteurProfes const { data: famillesMetiers, isFetching: isLoading } = useQuery( ["arborescence-rome-14-06-2021.json"], async () => { - const famillersMetiers = await _get("/arborescence-rome-14-06-2021.json"); + const famillersMetiers = await _getUI("/arborescence-rome-14-06-2021.json"); return famillersMetiers.map((familleMetiers) => normalizeRomeNodeInPlace(familleMetiers)); }, {