Skip to content

Commit

Permalink
Merge pull request #386 from navikt/dev
Browse files Browse the repository at this point in the history
[KAIZEN-0] Revertere endringer
  • Loading branch information
Jesperpaulsen authored Jan 8, 2024
2 parents b1d403d + 872ac68 commit 0df6f58
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/redux/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AktivBruker, AktivEnhet, AktorIdResponse, Saksbehandler } from '../inte
import failureConfig from './../mock/mock-error-config';
import { ProxyConfig } from '../domain';
import { FeatureToggles } from '../featureToggle/FeatureToggles';
import FeatureToggleManager from '../featureToggle/FeatureToggleManager';
// import FeatureToggleManager from '../featureToggle/FeatureToggleManager';

export enum ContextApiType {
NY_AKTIV_ENHET = 'NY_AKTIV_ENHET',
Expand Down Expand Up @@ -107,11 +107,7 @@ export async function getJson<T>(info: RequestInfo, init?: RequestInit): Promise
}
}

async function postJson<RESPONSE, REQUEST = any>(
url: string,
body: REQUEST,
options?: RequestInit
): Promise<FetchResponse<RESPONSE>> {
async function postJson<T>(url: string, body: T, options?: RequestInit): Promise<FetchResponse<T>> {
try {
const response: Response = await doFetch(url, {
...(options || {}),
Expand All @@ -123,7 +119,7 @@ async function postJson<RESPONSE, REQUEST = any>(
const content = await response.text();
return { data: undefined, error: content };
}
return { data: (await response.json()) as RESPONSE, error: undefined };
return { data: body, error: undefined };
} catch (error) {
return { data: undefined, error };
}
Expand Down Expand Up @@ -152,14 +148,14 @@ export async function hentAktorId(fnr: string): Promise<FetchResponse<AktorIdRes
return Promise.reject('Ugyldig fødselsnummer, kan ikke hente aktørId');
}

const isOn = await FeatureToggleManager.getToggle(FeatureToggles.IKKE_FNR_I_PATH);
// const isOn = await FeatureToggleManager.getToggle(FeatureToggles.IKKE_FNR_I_PATH);

if (isOn) {
return postJson<AktorIdResponse, String>(
`${urls.modiacontextholderUrl}/api/v2/decorator/aktor/hent-fnr`,
fnr
);
}
// if (isOn) {
// return postJson<AktorIdResponse, String>(
// `${urls.modiacontextholderUrl}/api/v2/decorator/aktor/hent-fnr`,
// fnr
// );
// }

return getJson<AktorIdResponse>(urls.aktorIdUrl(fnr));
}
Expand Down

0 comments on commit 0df6f58

Please sign in to comment.