File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import useSWR from "swr" ;
22import { fetchJson } from "../utils/api" ;
33import { HttpError } from "../utils/http" ;
4+ import { EKSPERTBISTAND_EREG_ADRESSE_PATH } from "../utils/constants" ;
45
56type AdresseResponse = {
67 adresse : string ;
@@ -21,7 +22,7 @@ const fetchAdresse = async (url: string): Promise<string | null> => {
2122export const useVirksomhetAdresse = ( orgnr : string | null | undefined ) => {
2223 const shouldFetch = Boolean ( orgnr ) ;
2324 const { data, error, isLoading } = useSWR < string | null > (
24- shouldFetch ? `/api/ereg /${ orgnr } /adresse` : null ,
25+ shouldFetch ? `${ EKSPERTBISTAND_EREG_ADRESSE_PATH } /${ orgnr } /adresse` : null ,
2526 fetchAdresse
2627 ) ;
2728
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { http, HttpResponse } from "msw";
22import { createEmptyInputs , type SoknadInputs } from "../features/soknad/schema" ;
33import { ensureIsoDateString } from "../utils/date" ;
44import type { Organisasjon } from "@navikt/virksomhetsvelger" ;
5- import { EKSPERTBISTAND_API_PATH } from "../utils/constants" ;
5+ import { EKSPERTBISTAND_API_PATH , EKSPERTBISTAND_EREG_ADRESSE_PATH } from "../utils/constants" ;
66
77const organisasjoner : Organisasjon [ ] = [
88 {
@@ -251,7 +251,7 @@ export const handlers = [
251251 http . get ( "/ekspertbistand-backend/api/organisasjoner/v1" , ( ) =>
252252 HttpResponse . json ( { hierarki : organisasjoner } )
253253 ) ,
254- http . get ( "/api/ereg/ :orgnr/adresse" , ( { params } ) => {
254+ http . get ( ` ${ EKSPERTBISTAND_EREG_ADRESSE_PATH } / :orgnr/adresse` , ( { params } ) => {
255255 const orgnr = getParamValue ( params . orgnr ) ;
256256 if ( ! orgnr || ! / ^ \d { 9 } $ / . test ( orgnr ) ) {
257257 return HttpResponse . json ( { message : "ugyldig orgnr" } , { status : 400 } ) ;
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export const EKSPERTBISTAND_API_PATH = withBasePath("/ekspertbistand-backend/api
2828export const EKSPERTBISTAND_ORGANISASJONER_PATH = withBasePath (
2929 "/ekspertbistand-backend/api/organisasjoner/v1"
3030) ;
31+ export const EKSPERTBISTAND_EREG_ADRESSE_PATH = withBasePath ( "/ekspertbistand-backend/api/ereg" ) ;
3132
3233export const SOKNADER_PATH = "/soknader" ;
3334
You can’t perform that action at this time.
0 commit comments