Skip to content

Commit

Permalink
[Mission] add EXISTING_MISSION_ACTION in errorCode and add source in …
Browse files Browse the repository at this point in the history
…created message in footer
  • Loading branch information
claire2212 authored and louptheron committed Feb 22, 2024
1 parent d10e6b9 commit f37824e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions frontend/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import type { AnyObject } from '@mtes-mct/monitor-ui'

// Don't forget to mirror any update here in the backend enum.
export enum ApiErrorCode {
EXISTING_MISSION_ACTION = 'EXISTING_MISSION_ACTION',
/** Thrown when attempting to delete an entity which has to non-archived children. */
FOREIGN_KEY_CONSTRAINT = 'FOREIGN_KEY_CONSTRAINT',

/** Thrown when attempting to archive an entity linked to non-archived children. */
UNARCHIVED_CHILD = 'UNARCHIVED_CHILD'
}

export interface BackendApiErrorResponse {
code: ApiErrorCode | null
type: ApiErrorCode | null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,11 @@ export function MissionForm() {
</div>
<div>
<MissionInfos>
{mainFormValues.createdAtUtc && (
<>Mission créée le {customDayjs(mainFormValues.createdAtUtc).utc().format('D MMM YYYY, HH:mm')}. </>
{mainFormValues.createdAtUtc && mainFormValues.missionSource && (
<>
Mission créée par le {Mission.MissionSourceLabel[mainFormValues.missionSource]} le{' '}
{customDayjs(mainFormValues.createdAtUtc).utc().format('DD/MM/YYYY à HH:mm')}.{' '}
</>
)}
{!mainFormValues.createdAtUtc && <>Mission non enregistrée. </>}
{mainFormValues.updatedAtUtc && (
Expand Down Expand Up @@ -692,6 +695,7 @@ export function MissionForm() {

const MissionInfos = styled.div`
font-style: italic;
color: ${p => p.theme.color.slateGray};
`

export const BackToListIcon = styled(Icon.Chevron)`
Expand Down

0 comments on commit f37824e

Please sign in to comment.