Skip to content

Commit

Permalink
fix(j-s): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
unakb committed May 10, 2024
1 parent b6581dd commit 9fce80e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ const Conclusion: React.FC = () => {
} else if (selectedAction === 'COMPLETE') {
handleCompletion()
} else if (postponement?.postponedIndefinitely) {
const updateSuccss = await updateCase(workingCase.id, {
const updateSuccess = await updateCase(workingCase.id, {
courtDate: null,
postponedIndefinitelyExplanation: postponement.reason,
})

if (!updateSuccss) {
if (!updateSuccess) {
return
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as constants from '@island.is/judicial-system/consts'
import { formatDate } from '@island.is/judicial-system/formatters'
import {
IndictmentCaseReviewDecision,
isCompletedCase,
isPublicProsecutor,
} from '@island.is/judicial-system/types'
import {
Expand All @@ -16,17 +15,14 @@ import {
SectionHeading,
UserContext,
} from '@island.is/judicial-system-web/src/components'
import {
Case,
CaseState,
} from '@island.is/judicial-system-web/src/graphql/schema'
import { useCase } from '@island.is/judicial-system-web/src/utils/hooks'

import { strings } from './ReviewDecision.strings'
import * as styles from './ReviewDecision.css'

interface Props {
workingCase: Case
caseId: string
indictmentAppealDeadline?: string
modalVisible?: boolean
setModalVisible: React.Dispatch<React.SetStateAction<boolean>>
onSelect?: () => void
Expand All @@ -38,7 +34,13 @@ export const ReviewDecision: React.FC<Props> = (props) => {
const { formatMessage: fm } = useIntl()
const { updateCase } = useCase()

const { workingCase, modalVisible, setModalVisible, onSelect } = props
const {
caseId,
indictmentAppealDeadline,
modalVisible,
setModalVisible,
onSelect,
} = props

const [indictmentReviewDecision, setIndictmentReviewDecision] = useState<
IndictmentCaseReviewDecision | undefined
Expand All @@ -48,7 +50,7 @@ export const ReviewDecision: React.FC<Props> = (props) => {
if (!indictmentReviewDecision) {
return
}
const updateSuccess = await updateCase(workingCase.id, {
const updateSuccess = await updateCase(caseId, {
indictmentReviewDecision: indictmentReviewDecision,
})
if (updateSuccess) {
Expand Down Expand Up @@ -79,7 +81,7 @@ export const ReviewDecision: React.FC<Props> = (props) => {
<Text variant="eyebrow">
{fm(strings.subtitle, {
indictmentAppealDeadline: formatDate(
workingCase.indictmentAppealDeadline,
indictmentAppealDeadline,
'P',
),
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ const IndictmentOverview = () => {
)}
{shouldDisplayReviewDecision && (
<ReviewDecision
workingCase={workingCase}
caseId={workingCase.id}
indictmentAppealDeadline={
workingCase.indictmentAppealDeadline ?? ''
}
modalVisible={modalVisible}
setModalVisible={setModalVisible}
onSelect={() => setIsReviewDecisionSelected(true)}
Expand Down

0 comments on commit 9fce80e

Please sign in to comment.