-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Missions] Ajout du nom de l'infraction (#2570)
## Linked issues - Resolve #2509 ---- - [ ] Tests E2E (Cypress)
- Loading branch information
Showing
8 changed files
with
86 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
frontend/src/features/SideWindow/MissionForm/hooks/useGetNatinfsAsOptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { useMemo } from 'react' | ||
|
||
import { useGetInfractionsQuery } from '../../../../api/infraction' | ||
|
||
import type { Option } from '@mtes-mct/monitor-ui' | ||
|
||
export function useGetNatinfsAsOptions() { | ||
const getInfractionsApiQuery = useGetInfractionsQuery() | ||
|
||
const natinfsAsOptions: Option<number>[] = useMemo(() => { | ||
if (!getInfractionsApiQuery.data) { | ||
return [] | ||
} | ||
|
||
return getInfractionsApiQuery.data.map(({ infraction, natinfCode }) => ({ | ||
label: `${natinfCode} - ${infraction}`, | ||
value: Number(natinfCode) | ||
})) | ||
}, [getInfractionsApiQuery.data]) | ||
|
||
return natinfsAsOptions | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters