Skip to content

Commit

Permalink
Fix empty national id
Browse files Browse the repository at this point in the history
  • Loading branch information
gudjong committed Dec 5, 2024
1 parent 40991f3 commit 15d5e0e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ const SelectDefender: FC<Props> = ({ defendant }) => {
caseId,
defendantId: defendant.id,
defenderNationalId: defendantWaivesRightToCounsel
? ''
: defendant.defenderNationalId,
? null
: defendant.defenderNationalId || null,
defenderName: defendantWaivesRightToCounsel
? ''
? null
: defendant.defenderName,
defenderEmail: defendantWaivesRightToCounsel
? ''
? null
: defendant.defenderEmail,
defenderPhoneNumber: defendantWaivesRightToCounsel
? ''
? null
: defendant.defenderPhoneNumber,
defenderChoice:
defendantWaivesRightToCounsel === true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ const Defendant = () => {
router.push(`${destination}/${createdCase.id}`)
} else {
toast.error(formatMessage(errors.createCase))
return
}
} else {
router.push(`${destination}/${workingCase.id}`)
Expand Down Expand Up @@ -416,14 +415,7 @@ const Defendant = () => {

const handleCreateDefendantClick = async () => {
if (workingCase.id) {
const defendantId = await createDefendant({
caseId: workingCase.id,
gender: undefined,
name: '',
address: '',
nationalId: null,
citizenship: '',
})
const defendantId = await createDefendant({ caseId: workingCase.id })

createEmptyDefendant(defendantId)
} else {
Expand All @@ -438,14 +430,7 @@ const Defendant = () => {
...prevWorkingCase,
defendants: prevWorkingCase.defendants && [
...prevWorkingCase.defendants,
{
id: defendantId || uuid(),
gender: undefined,
name: '',
nationalId: null,
address: '',
citizenship: '',
} as TDefendant,
{ id: defendantId || uuid() },
],
}))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,7 @@ const Defendant = () => {

const handleCreateDefendantClick = async () => {
if (workingCase.id) {
const defendantId = await createDefendant({
caseId: workingCase.id,
gender: undefined,
name: '',
address: '',
nationalId: '',
citizenship: '',
})
const defendantId = await createDefendant({ caseId: workingCase.id })

createEmptyDefendant(defendantId)
} else {
Expand All @@ -214,14 +207,7 @@ const Defendant = () => {
...prevWorkingCase,
defendants: prevWorkingCase.defendants && [
...prevWorkingCase.defendants,
{
id: defendantId || uuid(),
gender: undefined,
name: '',
nationalId: '',
address: '',
citizenship: '',
} as TDefendant,
{ id: defendantId || uuid() },
],
}))
}
Expand Down

0 comments on commit 15d5e0e

Please sign in to comment.