Skip to content

Commit

Permalink
format document
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaileshS1702 committed Sep 26, 2024
1 parent f8f6a34 commit 86f5765
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion webapp/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import { BiBlock, BiReceipt } from 'react-icons/bi';
import { Form } from 'react-final-form';
import PictureUpload from './PictureUpload';
import SignatureUpload from './SignatureUpload';
import { accountValidator, emailValidator, fullNameValidator } from 'utils/validators';
import {
accountValidator,
emailValidator,
fullNameValidator,
} from 'utils/validators';
import { mailToDataList } from 'utils/datalists';
import { FormButton, FormInput } from './elements';
import FormSelect from './elements/FormSelect';
Expand Down
9 changes: 6 additions & 3 deletions webapp/utils/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ export const requiredValidator: FieldValidator = (value?: string) =>
value ? undefined : 'Dette feltet er obligatorisk';

export const fullNameValidator: FieldValidator = (value?: string) => {
const namesWithlength = value?.split(" ").filter(name => name.length > 0);
if (!value?.includes(' ') || !namesWithlength || namesWithlength?.length < 2) {
const namesWithlength = value?.split(' ').filter((name) => name.length > 0);
if (
!value?.includes(' ') ||
!namesWithlength ||
namesWithlength?.length < 2
) {
return 'Vennligst skriv inn ditt fulle navn';
}

};

export const emailValidator: FieldValidator = (value?: string) => {
Expand Down

0 comments on commit 86f5765

Please sign in to comment.