Skip to content

Commit fd6d487

Browse files
committed
Oppdaterer path
1 parent 2d07d22 commit fd6d487

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎frontend/client/src/hooks/useVirksomhetAdresse.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import useSWR from "swr";
22
import { fetchJson } from "../utils/api";
33
import { HttpError } from "../utils/http";
4+
import { EKSPERTBISTAND_EREG_ADRESSE_PATH } from "../utils/constants";
45

56
type AdresseResponse = {
67
adresse: string;
@@ -21,7 +22,7 @@ const fetchAdresse = async (url: string): Promise<string | null> => {
2122
export 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

‎frontend/client/src/mocks/handlers.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { http, HttpResponse } from "msw";
22
import { createEmptyInputs, type SoknadInputs } from "../features/soknad/schema";
33
import { ensureIsoDateString } from "../utils/date";
44
import 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

77
const 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 });

‎frontend/client/src/utils/constants.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const EKSPERTBISTAND_API_PATH = withBasePath("/ekspertbistand-backend/api
2828
export 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

3233
export const SOKNADER_PATH = "/soknader";
3334

0 commit comments

Comments
 (0)