1
1
import { useAppIntl } from '@i18n/index' ;
2
2
import { useAmplitudeInstance } from '@navikt/sif-common-amplitude' ;
3
- import { FormikAttachmentForm , useAttachmentsHelper } from '@navikt/sif-common-core-ds' ;
3
+ import { FormikAttachmentForm , getAttachmentsValidator , useAttachmentsHelper } from '@navikt/sif-common-core-ds' ;
4
4
import Block from '@navikt/sif-common-core-ds/src/atoms/block/Block' ;
5
5
import SifGuidePanel from '@navikt/sif-common-core-ds/src/components/sif-guide-panel/SifGuidePanel' ;
6
6
import { Attachment } from '@navikt/sif-common-core-ds/src/types/Attachment' ;
@@ -28,11 +28,7 @@ const LegeerklæringStep = ({ onValidSubmit }: StepCommonProps) => {
28
28
persist ( { formValues : valuesToPersist , lastStepID : StepID . LEGEERKLÆRING } ) ;
29
29
} ;
30
30
31
- const { hasPendingUploads, maxTotalSizeExceeded } = useAttachmentsHelper (
32
- attachments ,
33
- andreVedlegg ,
34
- onAttachmentsChange ,
35
- ) ;
31
+ const { hasPendingUploads } = useAttachmentsHelper ( attachments , andreVedlegg , onAttachmentsChange ) ;
36
32
37
33
usePersistOnChange ( attachments , true , StepID . LEGEERKLÆRING ) ;
38
34
@@ -51,7 +47,7 @@ const LegeerklæringStep = ({ onValidSubmit }: StepCommonProps) => {
51
47
} }
52
48
useValidationErrorSummary = { false }
53
49
skipValidation = { true }
54
- buttonDisabled = { hasPendingUploads || maxTotalSizeExceeded } >
50
+ buttonDisabled = { hasPendingUploads } >
55
51
< Block padBottom = "xl" >
56
52
< SifGuidePanel compact = { true } >
57
53
< p >
@@ -69,6 +65,7 @@ const LegeerklæringStep = ({ onValidSubmit }: StepCommonProps) => {
69
65
addLabel : text ( 'steg.lege.vedlegg' ) ,
70
66
noAttachmentsText : text ( 'vedleggsliste.ingenLegeerklæringLastetOpp' ) ,
71
67
} }
68
+ validate = { getAttachmentsValidator ( { useDefaultMessages : true } , andreVedlegg ) }
72
69
uploadLaterURL = { getLenker ( intl . locale ) . ettersend }
73
70
onUnauthorizedOrForbiddenUpload = { userNotLoggedIn }
74
71
otherAttachments = { andreVedlegg }
0 commit comments