Skip to content

Commit

Permalink
Missions - fix affichage du nom de l'unité dans le filtre (#875)
Browse files Browse the repository at this point in the history
  • Loading branch information
thoomasbro committed Oct 17, 2023
2 parents c35ded2 + 1f4d81f commit 28b28d0
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { SingleTag } from '@mtes-mct/monitor-ui'
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 { useAppDispatch } from '../../../../hooks/useAppDispatch'
Expand All @@ -17,6 +18,8 @@ export function FilterTags() {
selectedThemes
} = useAppSelector(state => state.missionFilters)

const controlUnits = useGetControlUnitsQuery()

const onDeleteTag = (
valueToDelete: number | string,
filterKey: MissionFiltersEnum,
Expand All @@ -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}`)}
</SingleTag>
))}
{selectedMissionTypes.length > 0 &&
Expand Down

0 comments on commit 28b28d0

Please sign in to comment.