From 1f4d81f1497077bba863de0c06218292cf80dd91 Mon Sep 17 00:00:00 2001 From: Thomas Brosset Date: Thu, 12 Oct 2023 10:27:20 +0200 Subject: [PATCH] display name instead of id --- .../features/missions/MissionsList/Filters/FilterTags.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/features/missions/MissionsList/Filters/FilterTags.tsx b/frontend/src/features/missions/MissionsList/Filters/FilterTags.tsx index ca4019061..a2916677a 100644 --- a/frontend/src/features/missions/MissionsList/Filters/FilterTags.tsx +++ b/frontend/src/features/missions/MissionsList/Filters/FilterTags.tsx @@ -2,6 +2,7 @@ import { SingleTag } from '@mtes-mct/monitor-ui' import { useDispatch } from 'react-redux' import styled from 'styled-components' +import { useGetControlUnitsQuery } from '../../../../api/controlUnitsAPI' import { missionStatusLabels, missionTypeEnum } from '../../../../domain/entities/missions' import { MissionFiltersEnum, updateFilters } from '../../../../domain/shared_slices/MissionFilters' import { useAppSelector } from '../../../../hooks/useAppSelector' @@ -17,6 +18,8 @@ export function FilterTags() { selectedThemes } = useAppSelector(state => state.missionFilters) + const controlUnits = useGetControlUnitsQuery() + const onDeleteTag = ( valueToDelete: number | string, filterKey: MissionFiltersEnum, @@ -43,7 +46,7 @@ export function FilterTags() { key={unit} onDelete={() => onDeleteTag(unit, MissionFiltersEnum.UNIT_FILTER, selectedControlUnitIds)} > - {String(`Unité ${unit}`)} + {String(`Unité ${controlUnits.currentData?.find(controlUnit => controlUnit.id === unit)?.name || unit}`)} ))} {selectedMissionTypes.length > 0 &&