Skip to content

Commit

Permalink
✨ Legger på FormErrorSummary i ettersendelse
Browse files Browse the repository at this point in the history
Co-authored-by: Tor Idland <[email protected]>
  • Loading branch information
thomasrognes and tidnav committed Oct 18, 2023
1 parent e48415e commit 4be9f09
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions pages/ettersendelse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,24 @@ import { ArrowLeftIcon } from '@navikt/aksel-icons';
import { useRouter } from 'next/router';
import metrics from 'lib/metrics';
import { getSøknader } from './api/soknader/soknader';
import { LucaGuidePanel, ScanningGuide } from '@navikt/aap-felles-react';
import { LucaGuidePanel, ScanningGuide, Vedlegg } from '@navikt/aap-felles-react';
import { useIntl } from 'react-intl';
import Head from 'next/head';
import { FileUpload } from 'components/fileupload/FileUpload';
import { Error, FormErrorSummary } from 'components/FormErrorSummary/FormErrorSummary';
import { useState } from 'react';
import { setFocus } from 'lib/utils/dom';

const Ettersendelse = () => {
const { formatMessage } = useIntl();
const router = useRouter();
const { locale } = useIntl();

const router = useRouter();
const [errors, setErrors] = useState<Error[]>([]);
const errorSummaryId = 'errorSummary';

const addError = (errorsFromKrav: Error[]) => setErrors([...errors, ...errorsFromKrav]);
const deleteError = (vedlegg: Vedlegg) => setErrors(errors.filter((error) => error.id !== vedlegg.vedleggId));

return (
<>
Expand Down Expand Up @@ -67,11 +75,13 @@ const Ettersendelse = () => {
</div>
</Section>

<FormErrorSummary id={errorSummaryId} errors={errors} />

<FileUpload
krav="ANNET"
addError={() => {}}
deleteError={() => {}}
setErrorSummaryFocus={() => {}}
addError={addError}
deleteError={deleteError}
setErrorSummaryFocus={() => setFocus(errorSummaryId)}
onSuccess={() => {}}
/>
<Section>
Expand Down

0 comments on commit 4be9f09

Please sign in to comment.