diff --git a/apps/endringsmelding-frontend/src/main/js/src/App.tsx b/apps/endringsmelding-frontend/src/main/js/src/App.tsx
index 519a26df1d9..c793e3ac073 100644
--- a/apps/endringsmelding-frontend/src/main/js/src/App.tsx
+++ b/apps/endringsmelding-frontend/src/main/js/src/App.tsx
@@ -12,7 +12,7 @@ const App = () => (
} />
} />
- } />
+ } />
);
diff --git a/apps/endringsmelding-frontend/src/main/js/src/components/search/Search.tsx b/apps/endringsmelding-frontend/src/main/js/src/components/search/Search.tsx
index d5e31cd1150..4c285480ace 100644
--- a/apps/endringsmelding-frontend/src/main/js/src/components/search/Search.tsx
+++ b/apps/endringsmelding-frontend/src/main/js/src/components/search/Search.tsx
@@ -9,8 +9,8 @@ import {
WarningAlert,
WarningAlertstripe,
} from '@navikt/dolly-komponenter';
-import { Action } from '@/pages/endringsmelding-page/form/endringsmelding-form/EndringsmeldingReducer';
import _ from 'lodash';
+import { Api } from '@navikt/dolly-lib';
const Search = styled.div`
display: flex;
@@ -57,7 +57,7 @@ const StyledWarning = styled(WarningAlertstripe)`
width: -webkit-fill-available;
`;
-export default ({ labels, onChange, setMiljoer, dispatch }: Props) => {
+export default ({ labels, onChange, setMiljoer }: Props) => {
const [value, setValue] = useState('');
const [search, setSearch] = useState(null);
const [response, setResponse] = useState(null);
@@ -67,13 +67,18 @@ export default ({ labels, onChange, setMiljoer, dispatch }: P
const hentMiljoeInfo = async (ident: string) => {
setError(false);
setLoading(true);
- return fetch(`/endringsmelding-service/api/v1/ident/miljoer`, {
- method: 'POST',
- body: JSON.stringify({ ident }),
- })
+ return Api.fetchJson(
+ `/endringsmelding-service/api/v1/ident/miljoer`,
+ {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ },
+ JSON.stringify({ ident }),
+ )
.then((res) => {
+ console.log('res: ', res); //TODO - SLETT MEG
setLoading(false);
- setResponse(res.json());
+ setResponse(res);
})
.catch((reason) => {
setLoading(false);
@@ -93,6 +98,8 @@ export default ({ labels, onChange, setMiljoer, dispatch }: P
useEffect(() => {
if (search && search.length === 11) {
hentMiljoeInfo(search);
+ } else {
+ setError('Ident må være 11 siffer.');
}
}, [search]);