File tree 1 file changed +17
-2
lines changed
packages/shared-domain/src/utils/forms-api-backwards-compatibility
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -37,20 +37,35 @@ const mapInnsendingTypeToSubmissionTypes = (innsendingType?: InnsendingType): Su
37
37
}
38
38
} ;
39
39
40
+ const mapEttersendingTypeToSubmissionTypes = ( ettersending ?: InnsendingType ) : SubmissionType [ ] => {
41
+ if ( ! ettersending ) return [ 'PAPER' , 'DIGITAL' ] ;
42
+
43
+ switch ( ettersending ) {
44
+ case 'PAPIR_OG_DIGITAL' :
45
+ return [ 'PAPER' , 'DIGITAL' ] ;
46
+ case 'KUN_PAPIR' :
47
+ return [ 'PAPER' ] ;
48
+ case 'KUN_DIGITAL' :
49
+ return [ 'DIGITAL' ] ;
50
+ default :
51
+ return [ ] ;
52
+ }
53
+ } ;
54
+
40
55
/**
41
56
*
42
57
* Metoden er implementert kun for å støtte bakoverkompatibilitet og skal fjernes ved migrering
43
58
*/
44
59
const removeInnsendingFromForm = ( form : NavFormType ) : NavFormType => {
45
- const formProperties = ( ( { innsending, ettersending , ...rest } ) => rest ) ( form . properties ) ;
60
+ const formProperties = ( ( { innsending, ...rest } ) => rest ) ( form . properties ) ;
46
61
return {
47
62
...form ,
48
63
properties : {
49
64
...formProperties ,
50
65
submissionTypes :
51
66
form . properties . submissionTypes ?? mapInnsendingTypeToSubmissionTypes ( form . properties . innsending ) ,
52
67
subsequentSubmissionTypes :
53
- form . properties . subsequentSubmissionTypes ?? mapInnsendingTypeToSubmissionTypes ( form . properties . ettersending ) ,
68
+ form . properties . subsequentSubmissionTypes ?? mapEttersendingTypeToSubmissionTypes ( form . properties . ettersending ) ,
54
69
} ,
55
70
} ;
56
71
} ;
You can’t perform that action at this time.
0 commit comments