Skip to content

Commit

Permalink
fix: répare le lien vers l'arbo rome en local (#3286)
Browse files Browse the repository at this point in the history
  • Loading branch information
totakoko authored Oct 13, 2023
1 parent 734d735 commit 7b310f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions ui/common/httpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <T = any>(path: string, options?: AxiosRequestConfig<any>): Promise<T> => {
const response = await axios.get(path, {
headers: getHeaders(),
validateStatus: () => true,
httpsAgent: getHttpsAgent(),
...options,
});
return handleResponse<T>(path, response);
};

export const _get = async <T = any>(path: string, options?: AxiosRequestConfig<any>): Promise<T> => {
const response = await axios.get(`${publicConfig.baseUrl}${path}`, {
headers: getHeaders(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -45,7 +45,7 @@ const FiltreFormationSecteurProfessionnel = (props: FiltreFormationSecteurProfes
const { data: famillesMetiers, isFetching: isLoading } = useQuery<RomeNode[]>(
["arborescence-rome-14-06-2021.json"],
async () => {
const famillersMetiers = await _get<FamilleMetier[]>("/arborescence-rome-14-06-2021.json");
const famillersMetiers = await _getUI<FamilleMetier[]>("/arborescence-rome-14-06-2021.json");
return famillersMetiers.map((familleMetiers) => normalizeRomeNodeInPlace(familleMetiers));
},
{
Expand Down

0 comments on commit 7b310f4

Please sign in to comment.