@@ -2,23 +2,21 @@ import { useForm } from 'react-hook-form';
2
2
import { InputField } from '../Input/InputField.component' ;
3
3
import { getCustomNumberValidation } from '../../functions/functions' ;
4
4
5
- const customPostNumberValidation = getCustomNumberValidation (
6
- {
7
- minLength : 'Postnummer må være minimum 4 tall' ,
8
- maxLength : 'Postnummer må være maksimalt 4 tall' ,
9
- pattern : 'Postnummer må bare være tall' ,
10
- } ,
11
- 4
12
- ) ;
13
-
14
5
const inputs = [
15
6
{ label : 'Fornavn' , name : 'firstName' } ,
16
7
{ label : 'Etternavn' , name : 'lastName' } ,
17
8
{ label : 'Adresse' , name : 'address1' } ,
18
9
{
19
10
label : 'Postnummer' ,
20
11
name : 'postcode' ,
21
- customValidation : customPostNumberValidation ,
12
+ customValidation : getCustomNumberValidation (
13
+ {
14
+ minLength : 'Postnummer må være minimum 4 tall' ,
15
+ maxLength : 'Postnummer må være maksimalt 4 tall' ,
16
+ pattern : 'Postnummer må bare være tall' ,
17
+ } ,
18
+ 4
19
+ ) ,
22
20
} ,
23
21
{ label : 'Sted' , name : 'city' } ,
24
22
{
@@ -42,11 +40,6 @@ const inputs = [
42
40
8
43
41
) ,
44
42
} ,
45
- {
46
- label : 'Postnummer' ,
47
- name : 'postcode' ,
48
- customValidation : customPostNumberValidation ,
49
- } ,
50
43
] ;
51
44
52
45
const Billing = ( { onSubmit } ) => {
0 commit comments